Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > what's the use of SelectionModels?

Reply
Thread Tools

what's the use of SelectionModels?

 
 
Abs
Guest
Posts: n/a
 
      06-19-2004
Hi!

I hope you can enlighten me but I don't see the use of
SelectionModels when JList, JTable, etc. have methods to work with
selections. Why do you use SelectionModels ?


Regards
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      06-21-2004
Abs wrote:
> I hope you can enlighten me but I don't see the use of
> SelectionModels when JList, JTable, etc. have methods to work with
> selections. Why do you use SelectionModels ?


SelectionModel is quite useful when you want to change the basic way
that selection works for those components. For example, perhaps you
want a JTree component to only allow selection of leaf nodes; the
selection model can be used to accomplish this trivially.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
 
Michael Rauscher
Guest
Posts: n/a
 
      06-21-2004
Abs schrieb:
> Hi!
>
> I hope you can enlighten me but I don't see the use of SelectionModels
> when JList, JTable, etc. have methods to work with selections. Why do
> you use SelectionModels ?


There are a couple of reasons for using a SelectionModel. A model
notifies it's listeners whenever it changes.

Imagine a file chooser. On the left side there's a tree containing
directories, on the right side there are the details of the current
selected directory (the selection).

What one expects in such situations is, that if he selects a directory
in the directory tree, the details are updated. To do this, you register
a TreeSelectionListener with the tree's TreeSelectionModel and from this
time on your listener is notified whenever the selection set changes.

Bye
Michael

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not use ''; file already in use. M K ASP .Net 11 04-09-2008 11:35 AM
where to use CPLD & where to use FPGA? kulkarku@math.net VHDL 6 03-06-2006 07:27 AM
How do I know when to use the Viewstate and when to use the posted data? :-) Simon ASP .Net 1 11-09-2004 02:32 AM
Can I use XPath or something to a remote Mac or Linux box and just query an xml file, not using web services and use encyrption? jake ASP .Net 0 07-06-2004 02:16 PM
Cannot use the profile "default" because it is in use, not. please.post@yur.re.ply Firefox 1 07-04-2004 03:41 AM



Advertisments