aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes SWT/Swing JLabel repaint issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SWT/Swing JLabel repaint issue" Watch "SWT/Swing JLabel repaint issue" New topic
Author

SWT/Swing JLabel repaint issue

Kelly Dolan
Ranch Hand

Joined: Jan 08, 2002
Posts: 109
I am porting a Swing/AWT application to RCP/SWT. I created the top-level portion of my UI to use RCP/SWT. I have the view which parents an embedded Composite which parents a TabFolder containing TabItems. As a first step, one of my TabItems parents an AWT Frame (e.g., SWT_AWT.new_Frame(this)) which then parents the crux of my original Swing/AWT UI.

In this part of the UI I have a JPanel parenting a variety of centered JLabels. I also have an application thread that runs in the background and updates the text in these labels (e.g., status). In the Swing/AWT application, as the text changes (and gets longer and shorter), I see these changes and the length of the JLabel expands or collapses as necessary. In the RCP/SWT application, while I see the text changing, the length of the JLabel does not change. As a result, the new text is truncated (in the case it requires more space than there currently is) or not centered (in the case it does not require as much space than there current is).

I have tried calling revalidate(), validate() and repaint() on the JLabel and parenting JPanel.

Any help is appreciated!
Thanks!
 
jQuery in Action, 2nd edition
 
subject: SWT/Swing JLabel repaint issue