Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1020347 // jlist_doubleClickOnItem

JavaX fragment (include)

sbool jlist_doubleClickOnItem(final JList l, final int idx) {
  ret l != null && swing(func -> bool {
    Rect r = jlist_itemBounds(l, idx);
    if (r == null) false;
    
    long time = now();
    int x = rectCenterX(r), y = rectCenterY(r);
    MouseEvent press   = new(l, MouseEvent.MOUSE_PRESSED,  time, 0, x, y, 2, false, MouseEvent.BUTTON1);
    MouseEvent release = new(l, MouseEvent.MOUSE_RELEASED, time, 0, x, y, 2, false, MouseEvent.BUTTON1);
    MouseEvent click   = new(l, MouseEvent.MOUSE_CLICKED,  time, 0, x, y, 2, false, MouseEvent.BUTTON1);

   l.dispatchEvent(press);
   l.dispatchEvent(release);
   l.dispatchEvent(click);
   true;
  });
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020347
Snippet name: jlist_doubleClickOnItem
Eternal ID of this version: #1020347/4
Text MD5: 07c8b63b7fc9c6ab12da7139e718d9d5
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 20:11:24
Source code size: 674 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 319 / 368
Version history: 3 change(s)
Referenced in: [show references]