1 Replies - 2443 Views - Last Post: 31 March 2014 - 01:45 AM Rate Topic: -----

#1 meena1234   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-August 13

how to change an image on label dynamically in java swing

Posted 31 March 2014 - 12:45 AM

I am working on graphical projection of n queens.I am using swings in java.I need to dynamically change the positions of queens. I used gridbaglayout and labels to create a chessboard in Frame. Now the problem is i need to show the movement of chess queens which is not happening but is only showing the final o/p i.e., not showing the changing of queen from one grid to other.How do i do that?
I used setIcon() to put the image.
Is This A Good Question/Topic? 0
  • +

Replies To: how to change an image on label dynamically in java swing

#2 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3682
  • View blog
  • Posts: 16,896
  • Joined: 20-September 08

Re: how to change an image on label dynamically in java swing

Posted 31 March 2014 - 01:45 AM

Try calling repaint and validate after setting the new image

This post has been edited by g00se: 31 March 2014 - 01:45 AM
Reason for edit:: Clarification

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1