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

18
LINES

< > BotCompany Repo | #1026645 // jcenteredbuttons_withPopDown - hide some buttons in pop-down menu

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

Libraryless. Click here for Pure Java version (4173L/28K).

static JPanel jcenteredbuttons_withPopDown(int maxToShow, O... params) {
  new L<JComponent> l;
  new L popDownParams;
  for (int i = 0; i < l(params); i += 2)
    if (params[i] != null) {
      if (l(l) >= maxToShow) {
        popDownParams.add((S) params[i]);
        popDownParams.add(params[i+1]);
      } else
        if (params[i] instanceof JComponent)
          l.add((JComponent) params[i--]);
        else
          l.add(jbutton((S) params[i], params[i+1]));
    }
  if (nempty(popDownParams))
    l.add(jPopDownButton_noText(toObjectArray(popDownParams));
  ret jcenteredline(l);
}

Author comment

Began life as a copy of #1010175

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026645
Snippet name: jcenteredbuttons_withPopDown - hide some buttons in pop-down menu
Eternal ID of this version: #1026645/1
Text MD5: b09f7b99824a39caaeffd8d73d6cf7a8
Transpilation MD5: 3f0e093e1e01e26f2120d528aac8b212
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-18 15:41:45
Source code size: 610 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 248 / 333
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)