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

54
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);
      
    ifdef restrictAllWindowsToScreenSize
      restrictWindowToScreenSize(frame);
    endifdef
    
    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  old transpilations   

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

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/24
Text MD5: 14404f74d18a31a58fe20df75888680e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-20 19:45:48
Source code size: 1429 bytes / 54 lines
Pitched / IR pitched: No / No
Views / Downloads: 868 / 1902
Version history: 23 change(s)
Referenced in: #1001623 - showFrame (synonym of makeFrame)
#1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1014782 - _initFrame - add title menu and register frame
#1033421 - makeUndecoratedFrame
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)