I started coding java a few days ago. İ made a few succesfull programs but im stuck on this one. Where ever i write the \"Public static void main(String[] args)\" code i get
Have your constructor be separate from the main
method, and have its name be the same as your class name (i.e. public Panel_Test
since the name of your class is Panel_Test
).
public class Panel_Test extends JFrame {
public Panel_Test() {
// code here
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new Panel_Test();
}
});
}
}
Don't forget to do your Swing operations on the Event Dispatch Thread, using javax.swing.SwingUtilities
.