import java.awt.EventQueue;

import javax.swing.JFrame;


public class tatat extends JFrame {

	private static final long serialVersionUID = 1L;

	public static void main(String args[]) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					tatat frame = new tatat();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	public tatat() {
		super();
		setBounds(100, 100, 500, 375);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
	}

}

I'm new to java. I'm confused on how to bring "public tatat ()" into the main method above without writing a separate statement as shown above? Please advise. Thanks.

Recommended Answers

All 3 Replies

What you are saying doesn't make any sense, but you could create a separate class and call the constructor "tatat" inside that class's main method.

But if are not familiar with constructors and using multiple classes from different files in one single main, then you should not been writing swing, even though the NetBeans will auto generate everything for you

As I said I'm new to java, and I don't think it swing is a problem, I'm learning..... anyway thanks for your advise.

> As I said I'm new to java

Then you should try reading the stickies at the top of this forum and get your Java basics cleared up before messing around with complicated stuff like GUI etc.

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.