java - JFrame not working after first instantiation? -


As part of a larger application, I am writing a settings class, which collects user-defined settings and This class is a singleton, and the application is installed during startup.

To accept user input, configure two different GUI frames. From a public static method, select Settings () from within Java. Both are sub-classes of JFrame. Here is the code for the immediate file selection dialog:

  Select Private Zero file () {SelectFileGUI fileSelector = New SelectFileGUI (); FileSelector.setVisible (true); Synchronize (this) {try (wait); } Hold (exception e) {e.printStackTrace (); }} FileSelector.dispose (); }  

This works when the application is initially run. However, at a point later, users can change their selected settings, including choosing a new source file. This is done by calling the Selection settings () again.

The problem I have is that any subsequent attempt to instantiate and display these GUI components shows a new jefram, but with a gray background, No buttons or other components shown. While debugging I have also failed to make new examples of selectFileGUI directly.

What could be the reason for such behavior?

I will check to see that the second time you call, using the GUI thread Are or are calling from one of their own threads.

At the top of that method can test it (AWT thread is quite easily identified by name) and it has thrown an exception so that developers do not call it on the wrong thread - Or you can block your thread and do it in a worker thread.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -