JScrollPane not working? Please help

Hi there,
I am trying to incorporate a JScrollPane into a JList in my program, basically I make it so that JList is comprised of array of Strings. So the code looks like:
javax.swing.JPanel          jpanelListSnps            = new javax.swing.JPanel();
jpanelListSnps.setLayout(new java.awt.BorderLayout());
String[] stringArray    =  new String[123] //that's the actual amount of elements in the string
//initializing each elements of array....I will skip that part
javax.swing.JScrollPane  jscroll  =  new javax.swing.JScrollPane(stringArray);
jscroll.setPreferredSize(new java.awt.Dimension(30,30));
jlistSnps.addListSelectionListener(this);
jpanelListSnps.add(jlistSnps,"West");
jpanelListSnps.add(jscroll  ,"East");
jscroll.setAlignmentX(jpanelListSnps.RIGHT_ALIGNMENT);And I see the scrollbar, but I don't think the size is not properly adjusted. Also, I don't see the tab for the scrollbar. I don't know what is wrong with this code. Any suggestions or ideas would be much appreciated. Thank you in advance.
Regards,
Young

JList list = new JList( stringArray );
JScrollPane scrollPane = new JScrollPane( list );
panel.add(scrollPane, BorderLayout.EAST);

Similar Messages

Maybe you are looking for