Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList+JScrollPane problem  RSS feed

 
Dorj Galaa
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
}
 
Luong Nguyen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JScrollPane isn't added into the frame.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!