jordanwb Posted January 27, 2008 Share Posted January 27, 2008 I've never got this error before: NoClassDefFoundError. This is the game class: import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; public class Game extends JFrame { private Container c; public Game() { this.c = this.getContentPane (); this.c.setLayout (new FlowLayout ()); Scrabble_Square button = new Scrabble_Square (); <---- Error on this line button.set_letter ("l", Scrabble_Square.Wild_Text_Color); this.c.add (button); this.setVisible (true); } } Scrabble_Square class: import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; public class Scrabble_Square extends JButton { public static Color Square_Color = new Color (0x62, 0x144, 0x228); public static Color Default_Text_Color = Color.BLACK; public static Color Wild_Text_Color = Color.RED; public static Dimension Size = new Dimension (50, 50); private String letter; public Scrabble_Square() { this.setBackground (Scrabble_Square.Square_Color); this.setPreferredSize (Scrabble_Square.Size); } public void set_letter (String letter, Color color) { this.letter = letter; this.setEnabled (false); this.setForeground (color); } } I'm using Java 1.6.3 and BlueJ 2.2.1 Quote Link to comment https://forums.phpfreaks.com/topic/87982-solved-weird-java-error/ Share on other sites More sharing options...
jordanwb Posted January 28, 2008 Author Share Posted January 28, 2008 I fixed the problem. The problem was when I created Square_Color, the Color parameters were wrong. Quote Link to comment https://forums.phpfreaks.com/topic/87982-solved-weird-java-error/#findComment-451262 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.