• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Probs with JScrollPane

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I'm trying to add a JList in an JScrollPane as
you can see in the following snippet:
JList jList1 = new JList(new String[]{"gsfdg","gsfdgsfd","gsfdgs","gsfdgf"});
JScrollPane jScrollPane1 = new JScrollPane();
jScrollPane1.add(jList1);
contentPane.add(jScrollPane1, BorderLayout.CENTER);

if the application starts, the listItems are not displayed.
But if I try this code:
JList jList1 = new JList(new String[]{"gsfdg","gsfdgsfd","gsfdgs","gsfdgf"});
contentPane.add(new JScrollPane(jList1), BorderLayout.CENTER);

..everything works fine?
Has anybody an idea, why the first version does not work?
thx in advance
ak
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic