Hi, I am confused
need your help.
I have the following code segment:
public class TestClass extends JFrame {
public TestClass () {
...
JLabel testLabel ("This is a test");
getContentPane ().add (testLabel, BorderLayout.South);
setVisible (true);
}
...
}
It works fine, but if I add the label to a JScrollPane, and then add the JScrollPane to the Frame as follows, I can not see anything.
JLabel testLabel = new JLabel ("This is a test");
JScrollPane testPane = new JScrollPane ();
testPane.add (testLabel);
getContentPane ().add (testPane, BorderLayout.South);
Can someone tell me why? Is there anything special I need to do for JScrollPane? Thanks!