Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SWT/Swing JLabel repaint issue

 
Kelly Dolan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic