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

26
LINES

< > BotCompany Repo | #1004498 // showFullScreen - Exitable with Alt+F4, at least here it does so. Also adding Escape

JavaX fragment (include)

1  
static JFrame showFullScreen(JComponent c) {
2  
  ret showFullScreen(defaultFrameTitle(), c);
3  
}
4  
5  
static JFrame showFullScreen(fS title, final JComponent c) {
6  
  ret (JFrame) swingAndWait(func {
7  
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment()
8  
      .getDefaultScreenDevice();
9  
    if (!gd.isFullScreenSupported())
10  
      fail("No full-screen mode supported!");
11  
    bool dec = JFrame.isDefaultLookAndFeelDecorated();
12  
    if (dec) JFrame.setDefaultLookAndFeelDecorated(false);
13  
    final JFrame window = new JFrame(title);
14  
    window.setUndecorated(true);
15  
    if (dec) JFrame.setDefaultLookAndFeelDecorated(true);
16  
    registerEscape(window, r { disposeWindow(window) });
17  
    window.add(wrap(c));
18  
    gd.setFullScreenWindow(window);
19  
    
20  
    // Only this hides the task bar in Peppermint Linux w/Substance
21  
    for (int i = 100; i <= 1000; i += 100)
22  
      awtLater(i, r { window.toFront() });
23  
    
24  
    ret window;
25  
  });
26  
}

Author comment

Began life as a copy of #1004497

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: #1004498
Snippet name: showFullScreen - Exitable with Alt+F4, at least here it does so. Also adding Escape
Eternal ID of this version: #1004498/9
Text MD5: a68bb572a9376299020a48929baad272
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-03 01:23:57
Source code size: 960 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 601 / 618
Version history: 8 change(s)
Referenced in: [show references]