How to undecorate the game's frame? #688
Replies: 4 comments
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022).
Posted: 2019-11-25 13:57:05
User: AZ-0 [] (age: 1187 days 🔥; posts: 5)
Hello, first and foremost thanks for reading this post :D
I have been trying to undecorate the game's frame, as suggest the title, but the ~~
~~JFrame
of ~~~~GameWindow
is apparently visible right after ~~~~Game#init()
and unexistant beforehand. Because of this, the method ~~~~JFrame#setUndecorated(boolean)
throw an error saying the frame is displayable. Sadly it remains displayable even after a call to ~~~~JFrame#setVisible(boolean)
with argument ~~~~false
, making it impossible to set the frame undecorated.Any clues on how to conturn that predicament?
Heres my code for now :
~~```java~~public class Lock { private static JFrame window; public static synchronized void main(String... args) { JFrame.setDefaultLookAndFeelDecorated(false); int mask = InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK; Game.info().setName("LOCK"); Game.info().setSubTitle("Escape Game"); Game.init(); Lock.window = (JFrame) Game.window().getHostControl(); Input.mouse().setGrabMouse(true); Input.keyboard().onKeyTyped(e -> { if ((e.getModifiersEx() & mask) == mask && e.getKeyCode() == KeyEvent.VK_E) { e.consume(); System.exit(0); } }); Game.start(); Lock.window.setUndecorated(true); //Throws the exception Lock.window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); Lock.window.setAlwaysOnTop(true); } }
Beta Was this translation helpful? Give feedback.
All reactions