Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: weird errors in my code

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default weird errors in my code

    hey everyone,

    I'm busy with java programming since a little while, and now i want to make a game, but i stumbled upon two problems:


    there's something wrong with the title of of the window the game will be shown in, and theres a problem with my public static void main
    error:

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    at GameFrame.main(GameFrame.java:33)

    screenshot:

    hwi.jpg

    my code:
    import javax.swing.*; 
    import java.awt.*;
     
     
    public class GameFrame extends JFrame {
    	public static String title = "Tower Defense Alpha - \"Java Game!"\"";
    	public static Dimension size = new Dimension(700, 550);
     
     
    	public GameFrame()	{
    		setTitle(title);
    		setSize(size);
    		setResizable(false);
    		setLocationRelativeTo(null);
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
    		init();
    	}
     
     
     
    	public void init() {
    		setLayout(new GridLayout(1, 1, 0, 0));
     
    		GameScreen Screen = new GameScreen();
    		add (Screen);
     
    		setVisible(true);
     
     
    	}
     
    	public static void main(String args[]) {
    		Frame frame = new Frame();
    	}
     
    }

    if anybody can help me, please do it
    Last edited by jobje325; August 17th, 2012 at 11:40 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: weird errors in my code

    theres a problem with my public static void main
    please copy and paste here the full text of the error messages.

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

    Please Edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Getting Exception Errors, But Not Sure How To Fix Code
    By noel222 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 3rd, 2012, 12:09 PM
  2. Code is giving an error in console, but there are no errors apparent in the code!
    By JamEngulfer221 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 15th, 2011, 09:30 PM
  3. I still have errors. Can you PLEASE correct my code?!
    By sam30317 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 6th, 2011, 06:10 AM
  4. Replies: 27
    Last Post: February 17th, 2011, 05:42 PM
  5. Please check the code for the errors
    By nrao in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 16th, 2010, 05:37 PM