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

8
LINES

< > BotCompany Repo | #1035497 // jAlwaysCheckedMenuItem

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9337L/52K).

static JCheckBoxMenuItem jAlwaysCheckedMenuItem(S text, Runnable action) {
  var mi = swing(-> new JCheckBoxMenuItem(text, true));
  addActionListener(mi, -> {
    if (!isChecked(mi)) setChecked(mi, true);
    callF(action);
  });
  ret mi;
}

Author comment

Began life as a copy of #1006523

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035497
Snippet name: jAlwaysCheckedMenuItem
Eternal ID of this version: #1035497/3
Text MD5: 952df0f42f0c6e336670b416c91505f5
Transpilation MD5: d07e2baffaa004a4f14a4775a1d4df7c
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-30 16:03:32
Source code size: 249 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 104 / 154
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1035498 - jMenuItemStayCheckedOnClick