Okey I am making a simple chess program as an assignment and I ran into a few problems

I coded a file called ChessPiece which is the Base class of all the chess Piece
eg King ,Queen and etc...

We have to create a interface class call ChessPaint that draw the picture of the chess piece ( we are given the pictures)

So I did

public ChessPiece implements ChessPaint()
        {
         .... other methods there 
         public void paint(Graphics2D g)
            {
              things goes in here
            }
        }
        
        public interface ChessPaint
        {
        	public void paint(Graphics2D g);
        }

So I created another class call set ChessSet that set it to a default position.

public ChessSet implements JComponent
    {
     .... method goes in here
     pubic void paint (Graphic g)
    {
      so i can print the damn pictures
    }
    }

and the JFrame Code
Construct the ChesseSet and it is suppose to call the paint function automatically but it doesn't it just print and empty JFrame

Any one got any idea what is wrong with this? This is driving me nuts

In ChessSet
pubic void paint (Graphic g)
should be
public void paintComponent (Graphic g) // this will be called by Swing autimatically

inside that method you need to access some kind of list of all the ChessPieces on the board and loop through the list calling their paint methods (because ChessPiece and ChessPaint are not Swing components their methods will not be called by Swing, yo have to call them yourself.)
There are other things to deal with, but that will do for a start.

Thanks mKorbel.

@ricedragon please read the DaniWeb Member rules before posting again. Secretly cross-posting on two sites is very bad manners. I wasted my time giving you information that you already been given on the other site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.