Very busy Swing/AWT thread

Discussion in 'Java' started by Ryan Phelps, Jul 7, 2004.

  1. Ryan Phelps

    Ryan Phelps Guest

    If your swing thread is so busy redrawing one component (~125 repaint
    requests/sec, only able to perform ~9 repaints/sec) what happens to
    your swing widgets? My Swing widgets, buttons, menus, etc., don't
    show up except under special circumstances.

    Special circumstances are when they have focus and paint the little
    dashed line around the button, or I click on their area and change
    their state -- stuff like that. Essentially, there has to be
    something that explicitly redraws the widgets in order for them to
    show up. My custom widget shows up great, it's constantly redrawing.

    My particular application is reading around 125 X-Y profiles from a
    remote measurement device and displaying them in a home-grown graph
    JComponent in an applet.

    Thanks.
    Ryan Phelps, Jul 7, 2004
    #1
    1. Advertising

  2. Ryan Phelps

    Chris Smith Guest

    Ryan Phelps wrote:
    > If your swing thread is so busy redrawing one component (~125 repaint
    > requests/sec, only able to perform ~9 repaints/sec) what happens to
    > your swing widgets? My Swing widgets, buttons, menus, etc., don't
    > show up except under special circumstances.


    What does your code look like? I suspect that either the redrawing of
    your custom component is not being done with repaint events as it
    should, or your other components are broken in such a way that they
    aren't trying to repaint. Repaint events should be queued and collapsed
    in such a way that one component's constant desire to repaint shouldn't
    prevent anyone else from doing so.

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
    Chris Smith, Jul 7, 2004
    #2
    1. Advertising

  3. Chris Smith wrote:
    > Ryan Phelps wrote:
    >
    >>If your swing thread is so busy redrawing one component (~125 repaint
    >>requests/sec, only able to perform ~9 repaints/sec) what happens to
    >>your swing widgets? My Swing widgets, buttons, menus, etc., don't
    >>show up except under special circumstances.

    >
    >
    > What does your code look like? I suspect that either the redrawing of
    > your custom component is not being done with repaint events as it
    > should, or your other components are broken in such a way that they
    > aren't trying to repaint. Repaint events should be queued and collapsed
    > in such a way that one component's constant desire to repaint shouldn't
    > prevent anyone else from doing so.
    >


    In addition to what Chris said, 125 repaints per second is probably
    eating up too much time. Unless you've got a really fancy monitor, it
    isn't that fast anyway. So why not use something in the 25 to 30 per
    second range? You will never be able to tell the difference looking at it.

    --
    knute
    email s/nospam/knute/
    Knute Johnson, Jul 8, 2004
    #3
  4. Ryan Phelps

    Roedy Green Guest

    On Thu, 08 Jul 2004 20:29:22 GMT, Knute Johnson <>
    wrote or quoted :

    >In addition to what Chris said, 125 repaints per second is probably
    >eating up too much time. Unless you've got a really fancy monitor, it
    >isn't that fast anyway. So why not use something in the 25 to 30 per
    >second range? You will never be able to tell the difference looking at it.


    what if you wanted to repaint as fast as possible, while still letting
    the rest of the app function?

    How might you arrange things?

    You would need some low priority thread to soak up all left over time.
    It might use paintImmediately (swing thread only?), or toss repaints
    into the queue and wait for completion before tossing another.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Jul 8, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Mark Bram
    Replies:
    2
    Views:
    5,933
    Robert Mark Bram
    Dec 11, 2003
  2. Miss Elaine Eos

    AWT -> Swing, blocked dispatch thread

    Miss Elaine Eos, Jan 4, 2004, in forum: Java
    Replies:
    2
    Views:
    726
    Miss Elaine Eos
    Jan 5, 2004
  3. mkrause
    Replies:
    0
    Views:
    652
    mkrause
    May 6, 2005
  4. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    442
    Raymond Hettinger
    Jul 27, 2003
  5. RoboHobby
    Replies:
    1
    Views:
    1,073
Loading...

Share This Page