AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

strange swing update problem even if using "invokeLater()"

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
Hendrik Jahnke
Guest





PostPosted: Thu Mar 04, 2004 8:18 am    Post subject: strange swing update problem even if using "invokeLater()" Reply with quote



Hi,

I hope someone can help me with this:
I'm using an applet to manage a SNMP device. Everytime SNMP packets
come in, their data is being displayed in several fields, lables,
tables etc., depending on the kind of data.
That means I have to update the GUI while it is being displayed, and
since SWING is not thread safe, I'm using SwingUtilities.invokeLater()
for the update process. I checked with
SwingUtilities.isEventDispatchingThread() and it returns "true" for
every update that is made, so everything SHOULD be fine.
Except that it isn't.
For example, there's a JLabel with a TitledBorder and some text in it.
If this label is being updated (the text is changed via setText())
while being displayed, the text of the TitledBorder gets BOLD, and the
header of a JTable that is being displayed in the same panel as the
label, shrinks to 2/3 of its original height.If I switch between
labels and select the corrupted one again, everything is fine again.
Calling repaint() after changing the text doesn't help.

Any suggestions?

Hendrik
Back to top
Thomas Weidenfeller
Guest





PostPosted: Thu Mar 04, 2004 8:25 am    Post subject: Re: strange swing update problem even if using "invokeLater( Reply with quote



Hendrik Jahnke wrote:
Quote:
Hi,

I hope someone can help me with this:

We run low on psychic power these days.

Check Sun's bug parade if this is a known bug. If not, follow the advice
on http://www.physci.org/codes/sscce.jsp

/Thomas


Back to top
Hendrik Jahnke
Guest





PostPosted: Fri Mar 05, 2004 7:10 am    Post subject: Re: strange swing update problem even if using "invokeLater( Reply with quote



Thomas Weidenfeller <nobody (AT) ericsson (DOT) invalid> wrote

Quote:
Hendrik Jahnke wrote:
Hi,

I hope someone can help me with this:

We run low on psychic power these days.

Check Sun's bug parade if this is a known bug. If not, follow the advice
on http://www.physci.org/codes/sscce.jsp

/Thomas

Unfortunately the project is relatively complex, so I can't post
working example code, at least not now. Am I the only one with the
described problem?
It comes down to these facts:
- there's a JPanel containing a JTable, a JLabel with text and a
TitledBorder, and
two JLabels with a TitledBorder and some RadioButtons in them
- when text of the JLabel containing only text is changed with
settText() (by an external event), all the titles of the TitledBorders
become bold and the Header of the JTable shrinks to 2/3 of its
original height
- when doing the update, I'm definitely using the EventDispatch Thread
via SwingUtilities.invokeLater()

Not a known problem?

Back to top
Thomas Weidenfeller
Guest





PostPosted: Fri Mar 05, 2004 8:04 am    Post subject: Re: strange swing update problem even if using "invokeLater( Reply with quote

Hendrik Jahnke wrote:
Quote:
Unfortunately the project is relatively complex, so I can't post
working example code,

You could. Just sit down, use your favorite editor and write example
code demonstrating the problem. Do you really think someone can figure
out what is going on from you list of components, without actually
seeing how you have set up, configured and interconnected them?

Ah well, it is your problem, not ours. If you don't want to spend time
on it, why should we?

/Thomas


Back to top
John Schank
Guest





PostPosted: Fri Mar 05, 2004 8:05 am    Post subject: Re: strange swing update problem even if using "invokeLater( Reply with quote

I don't know if I'm understanding the problem correctly, but...

Perhaps you'd have better luck if, instead of a JLabel with a titled
border and radio buttons in it. You could instead create a JPanel, and
put the label and buttons on the JPanel. Using some layout manager. The
titled border, in this case would apply to the JPanel, not the label
directly.

John Schank

On 2004-03-05 02:10:44 -0500, [email]hendrik.jahnke (AT) web (DOT) de[/email] (Hendrik Jahnke) said:

Quote:
Thomas Weidenfeller <nobody (AT) ericsson (DOT) invalid> wrote in message
news:<c26p25$foq$1 (AT) newstree (DOT) wise.edt.ericsson.se>...
Hendrik Jahnke wrote:
Hi,

I hope someone can help me with this:

We run low on psychic power these days.

Check Sun's bug parade if this is a known bug. If not, follow the
advice on http://www.physci.org/codes/sscce.jsp

/Thomas

Unfortunately the project is relatively complex, so I can't post
working example code, at least not now. Am I the only one with the
described problem?
It comes down to these facts:
- there's a JPanel containing a JTable, a JLabel with text and a
TitledBorder, and
two JLabels with a TitledBorder and some RadioButtons in them
- when text of the JLabel containing only text is changed with
settText() (by an external event), all the titles of the TitledBorders
become bold and the Header of the JTable shrinks to 2/3 of its
original height
- when doing the update, I'm definitely using the EventDispatch Thread
via SwingUtilities.invokeLater()

Not a known problem?



Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.