Search:

Type: Posts; User: Tedstriker

Search: Search took 0.22 seconds.

  1. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    Thought I would post in this thread instead of creating a new one, as my question is related. The next part of the book I'm working with is to add buttons to the window created. The following is my...
  2. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    import javax.swing.*;
    class Window extends JFrame
    //beginning of class
    {
    JPanel pnl = new JPanel() ;
    public static void main ( String[] args)
    //beginning of main method
    {...
  3. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    Ok, corrected that...looks like its getting better. However, I now get the following error:

    add ( pnl ) ;
    ^

    cannot find symbol - variable pnl
  4. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    Now I get this error:
    public Window()
    ^

    invalid method declaration; return type required
  5. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    import javax.swing.*;
    class Note extends JFrame
    //beginning of class
    {
    public static void main ( String[] args)
    //beginning of main method
    {
    JPanel pnl = new...
  6. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    Thanks Norm, but reading that just doesn't make sense to me. When it says JPanel pnl = newJPanel(); goes before the main method, where would that be? where would the different methods begin and end....
  7. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    So I've been messing around with this. While its still wrong, at least I got a different error (class, interface, or enum expected with the ^ under the word void) with this effort:



    import...
  8. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    Sorry Norm, but I'm having allot of trouble with this.....I gather my original code is arranged wrong due to the placement of my {s? How should they be arranged?
  9. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    the book I'm using reads as follows:

    1) Start a new program that imports all Swing components



    import javax.swing.* ;


    2)Create a subclass of the JFrame class named "Window" containing...
  10. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    I tried changing the class name, but it didn't seem to make a difference.

    I tried compiling it through the command prompt, and got the following results:

    Window.java:7: error: ';' expected
    ...
  11. Replies
    22
    Views
    1,679

    Re: Illegal start of expression

    import javax.swing.*;
    class Window extends JFrame
    {
    public static void main ( String[] args)
    {
    JPanel pnl = new JPanel() ;
    public Window()
    {
    super(...
  12. Replies
    22
    Views
    1,679

    Illegal start of expression

    import javax.swing.*;
    class Window extends JFrame
    {
    public static void main ( String[] args)
    {
    JPanel pnl = new JPanel() ;
    public Window()
    {
    super(...
Results 1 to 12 of 12