wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Updating a JLabel on a JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Updating a JLabel on a JPanel " Watch "Updating a JLabel on a JPanel " New topic
Author

Updating a JLabel on a JPanel

Dane Com
Greenhorn

Joined: Jun 15, 2011
Posts: 1
I am in need of assistance with regards as to how to update a JLabel on a JPanel - when an array is updated.

My main program passes in an arrayList to another JFrame program ( and I am able to confirm that the data in the arrayList has been passed into the program ). However, the jLabels are not being updated on the GUI when the program is ran. However, when I use the MOUSE to click on a section of the map I am able to update the map utilizing the mouse clicked and listener and I am then displaying the data from the arrayList.

I am using the same method (see below) to populate the labels so I know it works.


I know I need to employ an action listener to have the labels updated, but I have scoured the web to look for an example that utilizes a listener to update a JLabel and I have not been able to find one.

If anyone could offer assistance it would be greatly appreciated.

Thanks,
Dane
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Updating a JLabel on a JPanel