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 behaviour

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





PostPosted: Fri Sep 16, 2005 4:55 pm    Post subject: strange behaviour Reply with quote



I maintain a large, somewhat complicated application in which strange
behavior is being exhibited.

The behaviour has to do with JSlider actions which control
characteristics of a map (e.g. "+" increase, "-" decrease, "z" zoom out)
which intermidently do not work.

The way in which the program works is that a user selects criteria and
the map is drawn. If a user types an action command (e.g. "z") the map
should zoom out. Occasionally it does not. However, if the user
tranistions to a Xterm, or browser and then back again the command will
work.

The program is comprised of a series of vectors which are searched based
on certain criteria and a map is then created based on these variables:

The map is drawn in a jpanel1 and placed in a jpanel2
A JSlider is placed in the same jpanel2

I've traced part of the errant behaviout to a section of vector
searching (ie. if you comment out a few lines of 'if' and 'for' blocks)
the behaviour is absent). The code looks fine in the blocks.

Does anyone know what might cause something like this. The piece which
seems like a clue is that the transitioning to an xterm or browser will
'fix' the problems.

Sorry for the vagary but any thoughts would be appreciated
Thanks
Lou


Back to top
Roedy Green
Guest





PostPosted: Fri Sep 16, 2005 7:05 pm    Post subject: Re: strange behaviour Reply with quote



On Fri, 16 Sep 2005 16:55:06 GMT, Lou Lipnickey
<lou.lipnickey (AT) pobox (DOT) com> wrote or quoted :

Quote:
The behaviour has to do with JSlider actions which control
characteristics of a map (e.g. "+" increase, "-" decrease, "z" zoom out)
which intermidently do not work.

Is it just the slider that becomes unresponsive or the entire Swing
UI? If the latter, chances are you have either put the Swing EDT
threat to sleep or given too fat a chunk of work to do.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Back to top
Roedy Green
Guest





PostPosted: Fri Sep 16, 2005 7:08 pm    Post subject: Re: strange behaviour Reply with quote



On Fri, 16 Sep 2005 16:55:06 GMT, Lou Lipnickey
<lou.lipnickey (AT) pobox (DOT) com> wrote or quoted :

Quote:

The behaviour has to do with JSlider actions which control
characteristics of a map (e.g. "+" increase, "-" decrease, "z" zoom out)
which intermidently do not work.

If it is just the JSlider going unresponsive, you can instrument the
listener to see if the new values are being calculated correctly. Just
dump them on the console. If they are ok, your problem may rectified
with a repaint or invalidate/validate if you have changed component
sizes.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Back to top
Lou Lipnickey
Guest





PostPosted: Fri Sep 16, 2005 8:21 pm    Post subject: Re: strange behaviour Reply with quote

Its quite strange, it seem that 1/2 the GUI is inactive. It records
mouseclicks (you can draw on the map) but occasionally people report
that multiple mouseclicks are needed to draw a point but mostly the
slider is dead. Do you know what bringing an Xterm forward then bring
the Java app forward does to the Java VM that would reactivate the
JSlider? Thanks - Lou

Roedy Green wrote:

Quote:
On Fri, 16 Sep 2005 16:55:06 GMT, Lou Lipnickey
[email]lou.lipnickey (AT) pobox (DOT) com[/email]> wrote or quoted :


The behaviour has to do with JSlider actions which control
characteristics of a map (e.g. "+" increase, "-" decrease, "z" zoom out)
which intermidently do not work.


If it is just the JSlider going unresponsive, you can instrument the
listener to see if the new values are being calculated correctly. Just
dump them on the console. If they are ok, your problem may rectified
with a repaint or invalidate/validate if you have changed component
sizes.

Back to top
Roedy Green
Guest





PostPosted: Fri Sep 16, 2005 8:48 pm    Post subject: Re: strange behaviour Reply with quote

On Fri, 16 Sep 2005 20:21:53 GMT, Lou Lipnickey
<lou.lipnickey (AT) pobox (DOT) com> wrote or quoted :

Quote:
Its quite strange, it seem that 1/2 the GUI is inactive. It records
mouseclicks (you can draw on the map) but occasionally people report
that multiple mouseclicks are needed to draw a point but mostly the
slider is dead. Do you know what bringing an Xterm forward then bring
the Java app forward does to the Java VM that would reactivate the
JSlider? Thanks - Lou

Java reorders events. It sounds like something is getting higher
priority that looking after the slider, and whatever that thing is
chewing up the time.

Have a quick look through your listeners and make sure none are doing
anything that will take a long time. See
http://mindprod.com/jgloss/threadsafesafe.html
http://mindprod.com/jgloss/swing.html
http://mindprod.com/jgloss/thread.html

in particular follow the link to Sun's SwingWorker class to put any
event handler that will take a long time on its own thread (as
distinct from enqueuing it with invokeLater)

If it is not obvious what is taking the time, you need a profiler
http://mindprod.com/jgloss/profiler.html
to track down the culprit.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Back to top
Lou Lipnickey
Guest





PostPosted: Fri Sep 16, 2005 9:31 pm    Post subject: Re: strange behaviour Reply with quote

Thanks, I'll follow those links - Lou

Roedy Green wrote:

Quote:
On Fri, 16 Sep 2005 20:21:53 GMT, Lou Lipnickey
[email]lou.lipnickey (AT) pobox (DOT) com[/email]> wrote or quoted :


Its quite strange, it seem that 1/2 the GUI is inactive. It records
mouseclicks (you can draw on the map) but occasionally people report
that multiple mouseclicks are needed to draw a point but mostly the
slider is dead. Do you know what bringing an Xterm forward then bring
the Java app forward does to the Java VM that would reactivate the
JSlider? Thanks - Lou


Java reorders events. It sounds like something is getting higher
priority that looking after the slider, and whatever that thing is
chewing up the time.

Have a quick look through your listeners and make sure none are doing
anything that will take a long time. See
http://mindprod.com/jgloss/threadsafesafe.html
http://mindprod.com/jgloss/swing.html
http://mindprod.com/jgloss/thread.html

in particular follow the link to Sun's SwingWorker class to put any
event handler that will take a long time on its own thread (as
distinct from enqueuing it with invokeLater)

If it is not obvious what is taking the time, you need a profiler
http://mindprod.com/jgloss/profiler.html
to track down the culprit.

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.