aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Probs with JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Probs with JScrollPane " Watch "Probs with JScrollPane " New topic
Author

Probs with JScrollPane

swing it
Greenhorn

Joined: Aug 10, 2001
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Probs with JScrollPane