Results 1 to 4 of 4
- 10-25-2011, 05:36 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 41
- Rep Power
- 0
panel wont update when repaint is called
I am working on a chess program and its almost done. the problem i am having is that it is a network program, and moves are sent from one game to the other. when you make your move, everything works just fine. when your opponent makes a move, it doesnt appear until you click on a square. i added repaint methods to both squares(the square you move from and the square you move to), and this solved half the problem. what it did was make the piece dissappear from the square you moved from, but it still wont reappear on the square moved to. i dont know why this is happening. pieces are images stored in jlabels. I have tons of code so I didnt post any of it because my description is more helpful
- 10-25-2011, 05:39 PM #2
Re: panel wont update when repaint is called
If you want help, you'll have to provide an SSCCE that demonstrates the problem. Narrow your problem down to as few lines as possible. It's a process of elimination- does it work if you take out the networking? Then you know it's not the networking. Does it work if you take out the images? Then you know it's not the images. Repeat that until you know what the problem is.
How to Ask Questions the Smart Way
Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
Static Void Games forum - Come say hello!
- 10-25-2011, 05:58 PM #3
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,236
- Rep Power
- 13
Re: panel wont update when repaint is called
How do you move the piece?
a) the easiest way is to just move the icon, then the label will repaint itself automatically
b) if you move the label, then you need to revalidate() the panel you add the label to. Then the label will be painted automatically.
- 10-25-2011, 06:58 PM #4
Member
- Join Date
- Oct 2011
- Posts
- 41
- Rep Power
- 0
Similar Threads
-
Add panel to parent panel
By LovJava in forum AWT / SwingReplies: 10Last Post: 09-02-2010, 08:43 PM -
while running multiple thread repaint isnt being called....
By raptor in forum Threads and SynchronizationReplies: 4Last Post: 08-25-2010, 11:47 PM -
Why doesn't the panel update unless I drag the edges?
By Addez in forum New To JavaReplies: 1Last Post: 11-02-2009, 10:39 PM -
update() gets never called
By flok in forum AWT / SwingReplies: 8Last Post: 10-19-2009, 04:45 PM -
Repaint panel after open saved serialized array
By King8654 in forum AWT / SwingReplies: 1Last Post: 04-24-2008, 09:37 AM
Bookmarks