HELP !!! I am really frustrated

B

Bill C

Hi, I cannot figure out
what is wrong with this simple code.

I get "illegal start of type" as an error and "identifier expected" as
a second error with the file called SimpleGui5.java
as:
import javax.swing.*;
import java.awt.*;
import java.awt.event.


public class SimpleGui5 {




public static void main (String[] args) {

JFrame frame = new JFrame();

JButton button = new JButton("click HERE");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(button);

frame.setSize(300,300);

frame.setVisible(true);

}
)




But I don't get an error with the file called TwoButtons.java as:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class TwoButtons {



public static void main (String[] args) {
JFrame frame = new JFrame();

JButton button = new JButton("click HERE");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(button);

frame.setSize(300,300);

frame.setVisible(true);
}


}



WHY??? Am I blind?? Thank you!!!!
 
R

Ryan Stewart

Hi, I cannot figure out
what is wrong with this simple code.

I get "illegal start of type" as an error and "identifier expected" as
a second error with the file called SimpleGui5.java
as:
import javax.swing.*;
import java.awt.*;
import java.awt.event.
^^^
Notice something missing?

*snip the rest*
 
Y

Y2KYZFR1

(e-mail address removed) (Bill C) wrote in message
WHY??? Am I blind?? Thank you!!!!

yes you are blind, get a good syntax checking IDE, you are welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top