SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard dominique's Avatar
    Join Date
    Dec 2000
    Location
    orbis terrarum
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How Do I Refresh Components in a Java Swing GUI?

    I have a JList that is defined as

    private final JList _list = new JList(getList());

    where getList() returns a String[] array.

    I can change the String[] array elsewhere in the GUI so how can I have the JList refresh with the new options everytime I make a change? Is there some sort of

    <pseudocode>
    _list.refresh();
    </pseudocode>

    function that I could call?

    I also have the same problem with a JTextArea defined as

    private final JTextArea _textArea = new JTextArea(getMessage());

    where getMessage() returns a string. How can I have them refresh?

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi dominique,

    Since I don't "swing", I can't tell you. But perhaps the moderators will move this to the proper forum.

    mods: (java != javascript)

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Wizard dominique's Avatar
    Join Date
    Dec 2000
    Location
    orbis terrarum
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Vincent Puglia
    mods: (java != javascript)
    Of course not, but it's nonetheless still client side coding. I'm not talking about Java Server Pages. We don't have a Java/C/C++/C#/Fortran/Cobol/etc. forum so this one is as close as you get.

  4. #4
    SitePoint Addict Drinky's Avatar
    Join Date
    Jan 2001
    Location
    England
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Swing components don't have a refresh method because of the way they are built and work.

    try this

    _list.UpdateUI()


    I'm a bit rusty on the old java&swing
    Last edited by Drinky; Oct 27, 2001 at 05:40.
    Drinky


Bookmarks

Posting Permissions

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