Results 1 to 5 of 5
  1. #1
    bioa10 is offline Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    0

    Default Errors help please

    So i'm following this java book to learn java but when I try to follow the JFrame part of the book I get errors

    Pastebin: import javax.swing.*; import java.awt.*; public class JFrame { public stat - Pastebin.com

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Errors help please

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,104
    Rep Power
    6

    Default Re: Errors help please

    (sorry DB, I can't resist).

    Quote Originally Posted by bioa10 View Post
    So i'm following this java book to learn java but when I try to follow the JFrame part of the book I get errors

    Pastebin: import javax.swing.*; import java.awt.*; public class JFrame { public stat - Pastebin.com
    Java Code:
    public class JFrame {  // <---- notice the name of your class
            public static void main(String[] args) {
                    JFrame myFrame = new JFrame(); // <---- So is this a Swing JFrame or is it YOUR JFrame?
    Conflict is fun in a book, but keep it out of your code :)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    bioa10 is offline Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    0

    Default Re: Errors help please

    Quote Originally Posted by gimbal2 View Post
    (sorry DB, I can't resist).



    Java Code:
    public class JFrame {  // <---- notice the name of your class
            public static void main(String[] args) {
                    JFrame myFrame = new JFrame(); // <---- So is this a Swing JFrame or is it YOUR JFrame?
    Conflict is fun in a book, but keep it out of your code :)
    Thank you, I didn't know that the name would conflict.

    Also next time I post I will make sure I do it right :)

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,104
    Rep Power
    6

    Default Re: Errors help please

    Just so you know, you can fix it like this:

    Java Code:
    public class JFrame {  // <---- notice the name of your class
            public static void main(String[] args) {
                    javax.swing.JFrame myFrame = new javax.swing.JFrame(); // <---- and this is DEFINITELY the Swing JFrame, not yours
    But it is better to just pick proper names for you own classes.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Why do I keep getting these errors?
    By psx2514 in forum New To Java
    Replies: 9
    Last Post: 11-07-2012, 05:03 PM
  2. please help, so many errors..
    By mhel_14 in forum New To Java
    Replies: 1
    Last Post: 03-16-2011, 12:26 PM
  3. Replies: 4
    Last Post: 01-04-2011, 12:36 AM
  4. Help with three errors -.-
    By Insomniac Riot in forum New To Java
    Replies: 5
    Last Post: 03-30-2010, 06:52 PM
  5. Replies: 3
    Last Post: 03-08-2009, 01:51 AM

Posting Permissions

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