Results 1 to 5 of 5
  1. #1
    Digital Larry is offline Member
    Join Date
    Mar 2013
    Posts
    57
    Rep Power
    0

    Default How do I get a Swing dialog to redraw itself while I'm using it?

    For example, I may wish to have some options that are not displayed until I select a JCheckBox. I want to make sure also that it redraws in the same place (upper left corner) that it was when I made the change.

    I figure that (another thing I want to do) is to have changes I am making in this dialog update another graphical element (non-JComponent derived) via a listener.

    Thanks,

    DL
    Last edited by Digital Larry; 09-05-2014 at 03:33 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: How do I get a Swing dialog to redraw itself while I'm using it?

    Listener on check box.
    On click, add/display/remove/hide stuff.
    repaint.

    Should work.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Digital Larry is offline Member
    Join Date
    Mar 2013
    Posts
    57
    Rep Power
    0

    Default Re: How do I get a Swing dialog to redraw itself while I'm using it?

    Sounds easy! I'll give it a try. Thanks!

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: How do I get a Swing dialog to redraw itself while I'm using it?

    a CardLayout -might- also work for the requirement of swapping out components. Just displaying a different panel with less or more components is easier than having to remove and add components, especially in the area of doing the
    layout.

    How to Use CardLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,616
    Rep Power
    5

    Default Re: How do I get a Swing dialog to redraw itself while I'm using it?

    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. swt canvas.redraw doesn't work for clicking button
    By purplepare in forum SWT / JFace
    Replies: 4
    Last Post: 08-04-2014, 08:31 AM
  2. How to open pdf file in swing dialog?
    By asifzbaig in forum AWT / Swing
    Replies: 1
    Last Post: 10-06-2011, 03:47 PM
  3. scanned image save by swing dialog box
    By gaurav17may in forum AWT / Swing
    Replies: 8
    Last Post: 07-20-2010, 12:48 PM
  4. How to open a SAVE file dialog box without using SWING or AWT
    By SAYAN in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 02-25-2010, 01:30 AM
  5. Redraw panel in timer event
    By knuth in forum Advanced Java
    Replies: 6
    Last Post: 10-03-2009, 07:39 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
  •