Hello, I am converting an Applet from AWT to Swing - I expected this to be very straightforward but have got stuck with some Scrollable functionality.
Basically I have a JPanel that contains many smaller JPanels - a stack of them, one above the other. The view can only show about four of these smaller JPanels and when more are added I am expecting the JScrollPane to automatically add the vertical scroll bars - but it doesn't. I am changing the size of the JPanel that holds that smaller JPanels but the JScrollPane just does not seem to recognise that the size has changed. Here is the code: JPanel bhp = new JPanel(); bhp.setLayout(null); bhp.setBounds(0,0,400,100); ... some code to add smaller JPanels to the bhp // work out the size of the bhp bhp.setBounds(0,0,400,44 * mainarray.size()); bhp.setSize(400,44 * mainarray.size()); sp = new JScrollPane(bhp); sp.setBounds(0,0,400,150); sp.setSize(400,150); sp.setPreferredSize(new Dimension(400,150)); JPanel contentPane = new JPanel(); contentPane.setPreferredSize(new Dimension(400,150)); contentPane.add(sp, BorderLayout.CENTER); Is it possible that because I have set the bhp layout to null, this is preventing the JScrollPane from determining the bhp's height? Any suggestions would be most appreciated, or perhaps a pointer to some example where a JPanel is made scrollable using JScrollPane Thanks Khalid ******************************************************************** Visit our Internet site at http://www.rbsmarkets.com This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. The Royal Bank of Scotland plc is registered in Scotland No 90312 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB Regulated by the Financial Services Authority ******************************************************************** _______________________________________________ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing