HELP !!! I am really frustrated

Discussion in 'Java' started by Bill C, Sep 8, 2003.

  1. Bill C

    Bill C Guest

    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!!!!
     
    Bill C, Sep 8, 2003
    #1
    1. Advertising

  2. That should be

    import java.awt.event.*;

    Thomas


    Bill C schrieb:

    > 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!!!!
     
    Thomas Kellerer, Sep 8, 2003
    #2
    1. Advertising

  3. Bill C

    Ryan Stewart Guest

    (Bill C) wrote in message news:<>...
    > 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*
     
    Ryan Stewart, Sep 8, 2003
    #3
  4. Bill C

    Y2KYZFR1 Guest

    (Bill C) wrote in message
    >
    > WHY??? Am I blind?? Thank you!!!!


    yes you are blind, get a good syntax checking IDE, you are welcome.
     
    Y2KYZFR1, Sep 8, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan
    Replies:
    3
    Views:
    7,308
    Saravana [MVP]
    Apr 16, 2004
  2. Don Wash
    Replies:
    10
    Views:
    645
    Don Wash
    Jul 21, 2004
  3. Greg Williams

    Frustrated with struts validation

    Greg Williams, Aug 1, 2003, in forum: Java
    Replies:
    2
    Views:
    1,809
    Wendy S
    Aug 4, 2003
  4. nc
    Replies:
    1
    Views:
    528
    nice.guy.nige
    Feb 3, 2005
  5. Replies:
    30
    Views:
    1,028
    Arne Vajhøj
    Feb 10, 2008
Loading...

Share This Page