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

19
LINES

< > BotCompany Repo | #1003296 // packFrame - improved version of JFrame.pack() (with minimum & maximum size)

JavaX fragment (include)

1  
sint packFrame_minw = 150, packFrame_minh = 50;
2  
3  
static <A extends Component> A packFrame(final A c) {
4  
  swing {
5  
    Window w = getWindow(c);
6  
    if (w != null) {
7  
      w.pack();
8  
      int maxW = getScreenWidth()-50, maxH = getScreenHeight()-50;
9  
      w.setSize(
10  
        min(maxW, max(w.getWidth(), packFrame_minw)),
11  
        min(maxH, max(w.getHeight(), packFrame_minh)));
12  
    }
13  
  }
14  
  ret c;
15  
}
16  
17  
static JFrame packFrame(ButtonGroup g) {
18  
  ret packFrame(getFrame(g));
19  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003296
Snippet name: packFrame - improved version of JFrame.pack() (with minimum & maximum size)
Eternal ID of this version: #1003296/8
Text MD5: 09dd673669d4ec66186c3756ebbf72de
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-08 16:10:45
Source code size: 485 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 629 / 625
Version history: 7 change(s)
Referenced in: [show references]