This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel not updating after drawing on it.

 
Claudiu Constantinescu
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, I'm working on tictactoe game and I have this panel which has two arraylists one for Xs and one for 0s.
When my server validates a move it sends it to players who add that move to one of the X or O arraylist and then it calls the repaint method.
BUT, the problem is that the repaint doesn't work for the first lets say 3 4 moves.After that the panel repaints as it should.
So, I'm trying to repaint this panel after adding a Point to myMoves or hisMoves ArrayLists.
I'll add that panel code here.
 
Tony Docherty
Bartender
Pie
Posts: 2878
59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't see anywhere that calls repaint() is it in another class.
BTW if you are calling addMyMove() or addHisMove() on a thread other than the EDT then you should add some synchronization.
 
Claudiu Constantinescu
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the problem, it was the null parameter of the observer on drawImage() method and it was changed with 'this' . Maybe this will help someone else someday.
Solved and close.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic