2

I have JFrame, that is setUndecorated(true) and inside it's content pane there is a LwjglCanvas a libgdx application rendering it's things. I need at some point, do setUndecorated(false). But is seems to be impossible. the decorated state cannot be changed once JFrame has been displayed, the only way to do it is to either create new JFrame, or dispose the existing one, and pack it back. Both solutions are terrible for me, because both will eventually notify LwjglCanvas to stop, and once stopped it cannot be started again. I tried overwriting it's stop method, but it still get's messed up somehow.

Why do I need this?

I am trying to make a loading splash screen for libGDX desktop app, with a progress bar in it, that should display progress of my desktop app loading it's resources in opengl context. Splash screen has to be undecorated window, and when all loaded app itself should show, maximized and decorated.

Approaches that do not work:

  1. Use one JFrame, and switch between decorated modes.
  2. Try to move Lwjgl canvas from one JFrame to another
  3. Use 2 separate Lwjgl canvases (cannot be done, because only one Al context can be inited at a time)

How do I do this?

Avetis Zakharyan
  • 887
  • 2
  • 9
  • 20
  • I don't understand why your loading splash screen needs to have the LWjglCanvas in it. Why not have an undecorated JFrame for the splash screen and the main application screen with the JWjglCanvas in it. – Richard Neish May 18 '15 at 10:25
  • Because if I want complicated good looking graphics inside splash screen (like fancy progress bar, and animations) it will be a hell to put inside JFrame using swings standard functionality. – Avetis Zakharyan May 19 '15 at 10:49
  • 1
    You are mixing lightweight(JFrame) and heavyweight (Canvas) components. I'm sure thats not a good idea. See [here](http://stackoverflow.com/questions/12040131/swing-and-awt-mixing-is-bad-but-still-done-why) – Dawnkeeper May 20 '15 at 11:17
  • what can I use instead then? what other technology will fit best, to make a splash screen that has to look good and "graphical", with progress bar, and so that making of this would be most easy? Swing only, has very weak tooling to achieve what I need. – Avetis Zakharyan May 20 '15 at 14:49

0 Answers0