Reputation: 61
I have constructed a GUI, and now I am trying to start it from my controller (main.java) class. I have no idea how to do this. Instantiating it doesn't work (ie. GUI gui = new GUI(); doesn't work).
I feel like there's something obvious I'm missing, here, but an extensive google search has yielded me no results.
I am trying to run the GUI in the main thread and have a separate thread to do calls to process code (The separate thread I have yet to make), if this has any relevance to the question. (I don't know, I'm a beginner at Java and programming!)
Upvotes: 4
Views: 8272
Reputation: 285405
If your GUI is a Swing application, and if it extends JFrame (something I try to avoid), sometimes you also have to add
GUI gui = new GUI();
gui.setVisible(true);
But for more help, you'll need to give us more details. Also, if you're creating Swing applications, there is a wonderful set of tutorials that you can find here: Swing Tutorials. These can help you create and run Swing GUI's and also and more importantly to understand what your code is doing.
Upvotes: 7