• 0

Java Throwing Errors


Question

I installed Java and BlueJ for a project, I've got Breezyswing + TerminalIO installed in the directories;

jre6/lib/ext

jdk1.6.0_13/lib

Here's my code;

Code

Also in BlueJ, claiming it's loaded and system wide.

I compile fine and everything works, but then when I run the program I get this..

javaerror.jpg

Any ideas? I'm stumped!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

try this

/**
 * Write a description of class MasterMind here.
 * 
 * Luke Wotton
 * 19/4/2009
 */
public class MasterMind extends GBFrame {
	 JLabel NewGame;
	 JLabel Guess;
	 IntegerField Guess1;


	public MasterMind()  {
	  NewGame = addLabel ("New Game", 1, 2, 1, 1);
	 Guess = addLabel ("Guess", 0, 0, 1, 1);
	 Guess1  = addIntegerField (0,1,1,1,1);
	}



	public static void main (String[] args){
	  MasterMind tpo = new MasterMind();
	  tpo.setSize (400, 500);	//Set the window's size in pixels
	  tpo.setVisible (true);	 //Make the window visible

   }// end main
}

I think your problem is you are trying to use addIntegerField(), addLabel() without a context / object has not been init yet.

if you do it in the constructor, I suspect your problem will go away.

Link to comment
Share on other sites

  • 0

Thanks for the reply, but it sadly didn't work.

Could it be something to do with my libraries? I've installed BlueJ and the latest JDK on 2 machines and get this same error on both. Yet if I change Import BreezySwing.*' to Import BreezyGUI.* It works.

Am I missing something?

Link to comment
Share on other sites

  • 0

Well... Now here's a story.

Our lecturer gives us a link to the JDK 6 Update 13. Which doesn't work when using Breezyswing as an input method it seems.

I've since downloaded Update 11 which works. What a complete idiot of a bloke.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.