enter image description here
enter image description here
enter image description here
Okey I have a class that prints the board and another class that prints the Chess
how do I use the LayeredPane to merge them together like the example picture above? I been trying all day and nothing seems to work at all. I am using JFrame to print the picture.
-
possible duplicate of Java Classes , interface and Guitrashgod– trashgod2011年11月05日 17:35:58 +00:00Commented Nov 5, 2011 at 17:35
2 Answers 2
Your question doesn't tell us much about the structure of your program or the specific problem that you're having. I assume that you've gone through the JLayeredPane tutorial which should explain to you pretty much the workings of a JLayeredPane, and that you understand it fully, otherwise I assume that you'd ask for clarification for your points of confusion in your question above.
I've outlined one way that I've approached a similar project in this answer: does-adding-a-jlabel-to-a-jpanel-hide-the-jpanel. Please check it out and again review the Swing tutorial and ask if anything doesn't make sense.
Comments
You should print the chess and the board in the same paintComponent() method. So print them in the same class. You could use something like:
public void paintComponent(Graphics g) {
printBoard(g);
printChess(g);
}
4 Comments
Explore related questions
See similar questions with these tags.