wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JList+JScrollPane problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList+JScrollPane problem" Watch "JList+JScrollPane problem" New topic
Author

JList+JScrollPane problem

Dorj Galaa
Ranch Hand

Joined: May 29, 2001
Posts: 113
My code is : but JList can't scroll? why?
import javax.swing.*;
public class TestJList
{
public static void main(String args[])
{
JFrame jf1=new JFrame();
jf1.setSize(400,100);
String[] data = {"one", "two", "three", "four","five","six","seven","eight","nine","ten"};
JList jl1=new JList(data);
JScrollPane pane = new JScrollPane(jl1);
jl1.updateUI();
jf1.getContentPane().add(jl1);
jf1.setVisible(true);
}
}


Senior software engineer
Luong Nguyen
Ranch Hand

Joined: May 06, 2001
Posts: 31
The JScrollPane isn't added into the frame.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JList+JScrollPane problem