Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/87982-solved-weird-java-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.