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

49
LINES

< > BotCompany Repo | #1000921 - makeFrame (make JFrame and show it) - contains standard frame title popup menu

JavaX fragment (include)

static S makeFrame_defaultIcon;
sbool makeFrame_hideConsole;
static new ThreadLocal<VF1<JFrame>> makeFrame_post;

static JFrame makeFrame() {
  ret makeFrame((Component) null);
}

static JFrame makeFrame(O content) {
  ret makeFrame(programTitle(), content);
}

static JFrame makeFrame(S title) {
  ret makeFrame(title, null);
}

static JFrame makeFrame(S title, O content) {
  ret makeFrame(title, content, true);
}

static JFrame makeFrame(fS title, fO content, final bool showIt) {
  final VF1<JFrame> post = optParam(makeFrame_post);
  ret swing(func -> JFrame {
    if (getFrame(content) != null)
      ret getFrame(setFrameTitle((Component) content, title));
    final JFrame frame = new JFrame(title);
    if (makeFrame_defaultIcon != null)
      setFrameIconLater(frame, makeFrame_defaultIcon);
    _initFrame(frame);
    Component wrapped = wrap(content);
    if (wrapped != null)
      frame.getContentPane().add(wrapped);
    frame.setBounds(defaultNewFrameBounds());
    
    callF(post, frame);
    
    if (showIt)
      frame.setVisible(true);
    //callOpt(content, "requestFocus");
    //exitOnFrameClose(frame);
    
    if (showIt && makeFrame_hideConsole) {
      hideConsole();
      makeFrame_hideConsole = false;
    }
    
    ret frame;
  });
}

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1000921
Snippet name: makeFrame (make JFrame and show it) - contains standard frame title popup menu
Eternal ID of this version: #1000921/23
Text MD5: f44cd1681627d045c5488d11b5452b3a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-30 14:51:41
Source code size: 1317 bytes / 49 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 1450
Version history: 22 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1000921 & http://1000921.tinybrain.de