• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

horizontal JList

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this
 
This tiny ad is wafer thin:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic