My whole program works completely fine ~400 lines of code including comments, but I have this at the bottom of my code. This is the last bit of code in my java program...

Is this okay to have, if not what should I do instead.

private static void End() {

	}

	public static void main(String[] args) {

		javax.swing.SwingUtilities.invokeLater(new Runnable() {

			MyClass m = new MyClass();

			public void run() {
				m.End();

			}
		});
	}
}

Recommended Answers

All 2 Replies

Well, if your starting it as an application (and not an applet or web service or etc) then yes (assuming the actual "m.End()" method creates and displays the GUI). If the JFrame is being created in the constructor (and "MyClass" extends JFrame) then you should change that. Make "MyClass" extend JPanel (or JComponent) and have the "End" method create and show the JFrame adding "this" to it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.