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

20
LINES

< > BotCompany Repo | #1003664 // onTitleRightClick - install right-click listener on title bars (Substance L&F only)

JavaX fragment (include)

1  
// runnable = Runnable or voidfunc(MouseEvent)
2  
static void onTitleRightClick(final JFrame frame, final O runnable) {
3  
  awt {
4  
    if (!isSubstanceLAF())
5  
      print("Can't add title right click!");
6  
    else {
7  
      JComponent titleBar = getTitlePaneComponent(frame);
8  
      //print("titleBar: " + titleBar);
9  
      titleBar.addMouseListener(new MouseAdapter {
10  
        public void mousePressed(MouseEvent e) {
11  
          //print("titleBar mousePressed " + e.getButton());
12  
          if (isNotLeftMouseButton(e)) {
13  
            //print("Calling " + runnable);
14  
            callF(runnable, e);
15  
          }
16  
        }
17  
      });
18  
    }
19  
  }
20  
}

Author comment

Began life as a copy of #1003463

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003664
Snippet name: onTitleRightClick - install right-click listener on title bars (Substance L&F only)
Eternal ID of this version: #1003664/1
Text MD5: 9243dda1e2f5fec0f8e456d9bdd97404
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-07 13:25:03
Source code size: 646 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 590 / 683
Referenced in: [show references]