wood burning stoves 2.0*
The moose likes Java in General and the fly likes horizontal JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "horizontal JList" Watch "horizontal JList" New topic
Author

horizontal JList

Kate Zoy
Ranch Hand

Joined: Feb 11, 2004
Posts: 33
I have some code that I thought would work to make an horizontal JList, but it doesn't.
listModel = new DefaultListModel();
someButton.addActionListener( new ActionListener(){
public void actionPerformed( ActionEvent ae ){
listModel.addElement( //i got some string in here );}});
list = new JList( listModel );
list.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
list.setLayoutOrientation( JList.HORIZONTAL_WRAP );
JScrollPane scroll = new JScrollPane( list );
panel.add( scroll );
So with this code, I get a little dot of a list and it never adds the items that are to be added in the list. When I remove the scroll, then it works fine, but still not horizontal. Anyone knows how to make this thing go horizontal?!
Thx!!!
Carlos Failde
Ranch Hand

Joined: Oct 20, 2000
Posts: 84
Try this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: horizontal JList
 
Similar Threads
need help to set horizontal bar to JList
JList (Scrollable?)
JList : how to add one simple element to a existing list??
format JList
Serializing/deserializing a list