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

17
LINES

< > BotCompany Repo | #1020347 // jlist_doubleClickOnItem

JavaX fragment (include)

1  
sbool jlist_doubleClickOnItem(final JList l, final int idx) {
2  
  ret l != null && swing(func -> bool {
3  
    Rect r = jlist_itemBounds(l, idx);
4  
    if (r == null) false;
5  
    
6  
    long time = now();
7  
    int x = rectCenterX(r), y = rectCenterY(r);
8  
    MouseEvent press   = new(l, MouseEvent.MOUSE_PRESSED,  time, 0, x, y, 2, false, MouseEvent.BUTTON1);
9  
    MouseEvent release = new(l, MouseEvent.MOUSE_RELEASED, time, 0, x, y, 2, false, MouseEvent.BUTTON1);
10  
    MouseEvent click   = new(l, MouseEvent.MOUSE_CLICKED,  time, 0, x, y, 2, false, MouseEvent.BUTTON1);
11  
12  
   l.dispatchEvent(press);
13  
   l.dispatchEvent(release);
14  
   l.dispatchEvent(click);
15  
   true;
16  
  });
17  
}

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: 321 / 371
Version history: 3 change(s)
Referenced in: [show references]