• 0

[JAVA] Update Swing Components


Question

Hi there...

Basically what i want to do is have a JPanel that contains a set of JLabels. Each of these JLabels represents something in a LinkedList in another object within the program. Does anyone know how to update the JPanel to reflect the new state of the LinkedList whenever it is changed (note: it doesnt need to have any sort of listener attached to the list, just some way of refreshing what the JPanel displays).

Thanks for any help

James

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

It sounds to me like you're making some kind of list containing all items in the LinkedList.

I kinda wonder why you don't use a jList then........

Anywayz, you tried using jFrame.repaint()?

you could also try a jFrame.show()...

(jFrame is the name of your frame, you can probably just use this.repaint() instead)

Link to comment
Share on other sites

  • 0

repaint() and show() i had both tried before.

The way to get it is

jpanel.invalidate();

jpanel.revalidate();

jpanel.repaint();

Which i found after much scouring of the net :D

--WeeJames

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.