JScrollPane

Hi

I am trying to make a JPanel which is added in a Container getContentPane.

In the JPanel there are so many JLabels that these are exceeding the size of the JFrame. I therefore wants to add a ScrollPane in the JPanel.Can ANy one suggest me how can i make it possible.?

Thankx

[302 byte] By [john8921a] at [2007-11-27 9:12:16]
# 1
add the panel to a JScrollPaneadd the scrollpane to the contentpanedepending on layoutManager used (and possibly other things) you may need to give the scrollPane a preferredSize
Michael_Dunna at 2007-7-12 21:58:35 > top of Java-index,Desktop,Core GUI APIs...
# 2
i am posting an excerpt frm my code jp4 = new JPanel(); jp4.setLayout(null);JScrollPane jSP=new JScrollPane(jp4); jSP.setAutoscrolls(true); getContentPane().add(jSP);is this correct thing to do?Its not working Plz help me in this regard.
john8921a at 2007-7-12 21:58:35 > top of Java-index,Desktop,Core GUI APIs...
# 3

> Its not working

looks like nothing has a size

try it like this

jp4 = new JPanel();

jp4.setPreferredSize(new Dimension(400,300));//<

jp4.setLayout(null);

JScrollPane jSP=new JScrollPane(jp4);

jSP.setAutoscrolls(true);

getContentPane().add(jSP);

setSize(200,200);//<

Michael_Dunna at 2007-7-12 21:58:35 > top of Java-index,Desktop,Core GUI APIs...