Results 1 to 3 of 3
  1. #1
    xnjiang is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Default Problem with the refresh of Swing components

    Hi everyone,

    I have a Swing application which has several Swing components (including a button) on a window.
    When clicking the button, a background DOS command will be executed which takes a long time.
    During this period, if I resize the window, the whole window will be displayed black - no component
    will be refreshed. (Once the background command is complete, the window will be displayed properly.)

    Anyone has experienced the similar problem?
    Thanks for your help.

    - Sean

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,987
    Rep Power
    9

    Default Re: Problem with the refresh of Swing components

    Yeah. Stop executing long-running tasks on the EDT. Use a SwingWorker or simply a new Thread instead.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

Similar Threads

  1. Using swing components in a handler
    By aianta in forum New To Java
    Replies: 6
    Last Post: 10-19-2011, 03:27 AM
  2. add remove swing components
    By willemjav in forum New To Java
    Replies: 6
    Last Post: 10-09-2008, 07:37 PM
  3. Problem In Swing Components
    By SANDY_INDIA in forum AWT / Swing
    Replies: 1
    Last Post: 07-19-2008, 10:23 PM
  4. How to print Swing components
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:04 PM
  5. Refresh components on javax.jms.MessageListener event
    By urir in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 01-08-2008, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •