Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2976 > unrolled thread

update after modifying th

Started by"a" <a@THRWHITE.remove-dii-this>
First post2011-04-27 15:42 +0000
Last post2011-04-27 15:42 +0000
Articles 6 — 4 participants

Back to article view | Back to comp.lang.java.gui


Contents

  update after modifying th "a" <a@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: update after modifyin "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
      Re: update after modifyin "a" <a@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
        Re: update after modifyin "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: update after modifyin "James" <james@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: update after modifyin "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000

#2976 — update after modifying th

From"a" <a@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Subjectupdate after modifying th
Message-ID<nd5gj.18295$uV6.557@pd7urf1no>
  To: comp.lang.java.gui
Hi

I need to modify the content of the JList on the fly. So, when I need to
update the JList, I rebuild the list model and re-initiate the JList by
using new operator. I need to resize the JFrame manually to see the new
JList. How should I program it to show the new JList right after I modifying
it?

Is JList a good component for dynamic list content?

Thanks

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#2977 — Re: update after modifyin

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: update after modifyin
Message-ID<47811cce$0$27797$b9f67a60@news.newsdemon.com>
In reply to#2976
  To: comp.lang.java.gui
a wrote:
> Hi
> 
> I need to modify the content of the JList on the fly. So, when I need to
> update the JList, I rebuild the list model and re-initiate the JList by
> using new operator. I need to resize the JFrame manually to see the new
> JList. How should I program it to show the new JList right after I modifying
> it?
> 
> Is JList a good component for dynamic list content?
> 
> Thanks
> 
> 

I suspect that you are having troubles adding and removing components 
not really with the JList.  But since we can't see your code it is hard 
to tell.

JList and the DefaultListModel are really good for adding and removing 
elements one at a time.  If you are going to completely change the 
content of the list maybe another component would work better for you. 
I have similar requirement in a program that I am working on and I use a 
JTextArea as a list component.  Periodically I have to update that 
component and I just set new content on it.  Also it lives in a 
JScrollPane so that I don't have to resize my frame to make it fit if 
the content suddenly exceeds the original size.

-- 

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2980 — Re: update after modifyin

From"a" <a@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: update after modifyin
Message-ID<Fwcgj.21433$uV6.16102@pd7urf1no>
In reply to#2977
  To: comp.lang.java.gui
I am able to add the component to the JList lives on the JPanel. But I have
to resize the JFrame to see the update, if I add the component on the fly.
JTextArea is not bad for adding and showing data dynamically. However, I may
need to show the icons with text together in the future. So, what kind of
component is the best?

Thanks for your reply.

"Knute Johnson" <nospam@rabbitbrush.frazmtn.com>
???????:47811cce$0$27797$b9f67a60@news.newsdemon.com...
> a wrote:
> > Hi
> >
> > I need to modify the content of the JList on the fly. So, when I need to
> > update the JList, I rebuild the list model and re-initiate the JList by
> > using new operator. I need to resize the JFrame manually to see the new
> > JList. How should I program it to show the new JList right after I
modifying
> > it?
> >
> > Is JList a good component for dynamic list content?
> >
> > Thanks
> >
> >
>
> I suspect that you are having troubles adding and removing components
> not really with the JList.  But since we can't see your code it is hard
> to tell.
>
> JList and the DefaultListModel are really good for adding and removing
> elements one at a time.  If you are going to completely change the
> content of the list maybe another component would work better for you.
> I have similar requirement in a program that I am working on and I use a
> JTextArea as a list component.  Periodically I have to update that
> component and I just set new content on it.  Also it lives in a
> JScrollPane so that I don't have to resize my frame to make it fit if
> the content suddenly exceeds the original size.
>
> -- 
>
> Knute Johnson
> email s/nospam/knute/
>
> --
> Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
>       ------->>>>>>http://www.NewsDem

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2981 — Re: update after modifyin

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: update after modifyin
Message-ID<478179e8$0$27825$b9f67a60@news.newsdemon.com>
In reply to#2980
  To: comp.lang.java.gui
a wrote:
> I am able to add the component to the JList lives on the JPanel. But I have
> to resize the JFrame to see the update, if I add the component on the fly.
> JTextArea is not bad for adding and showing data dynamically. However, I may
> need to show the icons with text together in the future. So, what kind of
> component is the best?
> 
> Thanks for your reply.

Do you call validate() on the JPanel after adding the component?  Are 
you doing this on the EDT?

-- 

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2979 — Re: update after modifyin

From"James" <james@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: update after modifyin
Message-ID<Skcgj.5889$Xo1.4465@trnddc06>
In reply to#2976
  To: comp.lang.java.gui
On Sun, 06 Jan 2008 14:04:03 +0000, a wrote:

> Hi
> 
> I need to modify the content of the JList on the fly. So, when I need to
> update the JList, I rebuild the list model and re-initiate the JList by
> using new operator. I need to resize the JFrame manually to see the new
> JList. How should I program it to show the new JList right after I
> modifying it?
> 
> Is JList a good component for dynamic list content?
> 
> Thanks

It is not! JList produces an immutable list. You should have noticed 
there is no .addItem method...

Check out classes that implement the ListModel interface, e.g. 
DefaultListModel class.
-- 
James
*Note: Remove every other letter for correct email address

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2983 — Re: update after modifyin

From"tar" <tar@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: update after modifyin
Message-ID<ymiir25sdan.fsf@blackcat.isi.edu>
In reply to#2976
  To: comp.lang.java.gui
"a" <a@mail.com> writes:

> Hi
> 
> I need to modify the content of the JList on the fly. So, when I need to
> update the JList, I rebuild the list model and re-initiate the JList by
> using new operator.

Why not just use the JList setModel or setListData method?

-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web