Search code examples
javaswinginitializationjframe

Initializing a JFrame


This is probably an easy question, but hey, i'm a beginner.

So I've created a program that calculates some stuff, and it's running in the console at the moment. I decided to add a user interface to it, so i created a JForm using the built in features in NetBeans IDE (probably just temporary until i learn to handle Swing manually, i have a deadline so i want to finish it fast), and draw out a few controls and containers. Now that the form is ready, how do i initialise it? As far as i know i need to call the class from Main.java somehow, correct? I've tried just doing: GUI gui = new GUI(); (the class is called GUI), but that doesn't do anything. If i leave it blank it does the same thing. Or is it suppose to initialize itself?

Thanks.


Solution

  • GUI gui = new GUI(); 
    gui.setVisible(true);