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

48
LINES

< > BotCompany Repo | #1009948 // addInternalFrame - add JInternalFrame to JDesktopPane and activate

JavaX fragment (include)

static new ThreadLocal<Bool> addInternalFrame_dontSelect;
static new ThreadLocal<Int> addInternalFrame_layer;
static new ThreadLocal<Bool> addInternalFrame_toBack;

static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final int x, final int y, final int w, final int h) {
  ret addInternalFrame(desktop, title, x, y, w, h, null);
}

static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final int x, final int y, final int w, final int h, final Component contents) {
  ret addInternalFrame(desktop, title, rect(x, y, w, h), contents);
}

static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final Component contents) {
  ret addInternalFrame(desktop, title, null, contents);
}

static JInternalFrame addInternalFrame(final JDesktopPane desktop, fS title, final Rect r, final Component contents) {
  final bool dontSelect = isTrue(optParam(addInternalFrame_dontSelect));
  final bool toBack = isTrue(optParam(addInternalFrame_toBack));
  final Int layer = optParam(addInternalFrame_layer);
  ret swing(func -> JInternalFrame {
    JInternalFrame frame;
    if (contents instanceof JInternalFrame)
      frame = (JInternalFrame) contents;
    else {
      frame = jInternalFrame(title);
      setInternalFrameContents(frame, contents);
    }
    frame.setVisible(true);
    desktop.add(frame, layer);
    if (r != null)
      setBounds(frame, r);
    else
      internalFrameDefaultPosition(frame);
    if (dontSelect)
      if (toBack)
        frame.toBack();
      else
        frame.toFront();
    else
      frame.setSelected(true);
    ret fixInternalFrame(frame);
  });
}

static JInternalFrame addInternalFrame(JDesktopPane desktop, S title) {
  ret addInternalFrame(desktop, title, jpanel());
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009948
Snippet name: addInternalFrame - add JInternalFrame to JDesktopPane and activate
Eternal ID of this version: #1009948/30
Text MD5: 12933e9477714d5ccd99fc26743fbb71
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-15 03:33:15
Source code size: 1818 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 610 / 644
Version history: 29 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1011113 - showInternalFrame - synonym of addInternalFrame
#1011117 - showCenteredInternalFrame