Results 1 to 8 of 8
  1. #1
    Miller786 is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Unhappy I dont understand this error, help please

    here is the code, i just wanted to draw a simple yellow rectangle in white background...

    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class NewEmpty extends Jframe {
    Rectangle test = new Rectangle(100,100,100,100);
    public NewEmpty()
    {
    super("Game Test");
    setSize(400,400);
    setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
    setVisible(true);
    }
    public void paint(Graphics g)
    {
    super.paint(g);
    g.setColor(Color.WHITE);
    g.fillRect(0,0,400,400);
    g.setColor(Color.YELLOW);
    g.fillRect(test.x,test.y,test.width,test.height);
    }
    public static void main (String[] args)
    {
    new NewEmpty();
    }
    }


    errors in the compiler ( i think there's something wrong with that Jframe)

    init:
    deps-jar:
    Compiling 1 source file to C:\Users\****\Gametest\build\classes
    C:\Users\Marco\Gametest\src\gametest\NewEmpty.java :6: error: cannot find symbol
    public class NewEmpty extends Jframe {
    symbol: class Jframe
    C:\Users\****\Gametest\src\gametest\NewEmpty.java: 11: error: cannot find symbol
    setSize(400,400);
    symbol: method setSize(int,int)
    location: class NewEmpty
    C:\Users\****\Gametest\src\gametest\NewEmpty.java: 12: error: cannot find symbol
    setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
    symbol: variable Jframe
    location: class NewEmpty
    C:\Users\****\Gametest\src\gametest\NewEmpty.java: 13: error: cannot find symbol
    setVisible(true);
    symbol: method setVisible(boolean)
    location: class NewEmpty
    C:\Users\****\Gametest\src\gametest\NewEmpty.java: 17: error: cannot find symbol
    super.paint(g);
    symbol: variable super
    location: class NewEmpty
    5 errors
    BUILD FAILED (total time: 0 seconds)

  2. #2
    milovan is offline Senior Member
    Join Date
    Jan 2011
    Location
    Belgrade, Serbia
    Posts
    301
    Rep Power
    4

    Default Re: I dont understand this error, help please

    Take a look on errors, try to correct first one that says you want to extend Jframe. there is no Jframe unless you created one with that name. correct it and try again.

  3. #3
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: I dont understand this error, help please

    Capitalization matters.
    Get in the habit of using standard Java naming conventions!

  4. #4
    Miller786 is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: I dont understand this error, help please

    Could you please explain how to create a Jframe then?

  5. #5
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: I dont understand this error, help please

    If you want a Jframe, you'll have to write it yourself. Nobody knows what a Jframe is.

    A JFrame, on the other hand...
    Get in the habit of using standard Java naming conventions!

  6. #6
    Miller786 is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: I dont understand this error, help please

    Care to explain? i started programming a week ago
    I just want to show my program in a window, how can i do it?
    Last edited by Miller786; 02-01-2014 at 06:22 PM.

  7. #7
    milovan is offline Senior Member
    Join Date
    Jan 2011
    Location
    Belgrade, Serbia
    Posts
    301
    Rep Power
    4

    Default Re: I dont understand this error, help please

    So you want to use JFrame and you misspell it with Jframe.
    Clearer?

  8. #8
    Miller786 is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: I dont understand this error, help please

    Oh jesus, i wrote it wrong, thank you very much...

Similar Threads

  1. I dont understand this question...
    By Akirien in forum New To Java
    Replies: 8
    Last Post: 08-07-2012, 07:56 PM
  2. ¿Values by Reference? I dont understand...
    By Daxan in forum New To Java
    Replies: 3
    Last Post: 02-22-2012, 11:27 PM
  3. HELP ...DONT UNDERSTAND Error
    By ask4soteria in forum New To Java
    Replies: 6
    Last Post: 11-26-2010, 09:43 AM
  4. Replies: 3
    Last Post: 07-28-2010, 02:49 PM
  5. Dont understand Return Statement.
    By ocean in forum New To Java
    Replies: 6
    Last Post: 10-22-2009, 12:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •