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)

static JFrame showFullScreen(JComponent c) {
  ret showFullScreen(defaultFrameTitle(), c);
}

static JFrame showFullScreen(fS title, final JComponent c) {
  ret (JFrame) swingAndWait(func {
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment()
      .getDefaultScreenDevice();
    if (!gd.isFullScreenSupported())
      fail("No full-screen mode supported!");
    bool dec = JFrame.isDefaultLookAndFeelDecorated();
    if (dec) JFrame.setDefaultLookAndFeelDecorated(false);
    final JFrame window = new JFrame(title);
    window.setUndecorated(true);
    if (dec) JFrame.setDefaultLookAndFeelDecorated(true);
    registerEscape(window, r { disposeWindow(window) });
    window.add(wrap(c));
    gd.setFullScreenWindow(window);
    
    // Only this hides the task bar in Peppermint Linux w/Substance
    for (int i = 100; i <= 1000; i += 100)
      awtLater(i, r { window.toFront() });
    
    ret window;
  });
}

Author comment

Began life as a copy of #1004497

download  show line numbers  debug dex   

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

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: 343 / 328
Version history: 8 change(s)
Referenced in: [show references]

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