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)

// runnable = Runnable or voidfunc(MouseEvent)
static void onTitleRightClick(final JFrame frame, final O runnable) {
  awt {
    if (!isSubstanceLAF())
      print("Can't add title right click!");
    else {
      JComponent titleBar = getTitlePaneComponent(frame);
      //print("titleBar: " + titleBar);
      titleBar.addMouseListener(new MouseAdapter {
        public void mousePressed(MouseEvent e) {
          //print("titleBar mousePressed " + e.getButton());
          if (isNotLeftMouseButton(e)) {
            //print("Calling " + runnable);
            callF(runnable, e);
          }
        }
      });
    }
  }
}

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: 524 / 613
Referenced in: [show references]