Hi,
I need scroll pane which does not resize its child.
I.e. the child must always keep its preferred size.
If the scroll pane it bigger than the child, the child should
be aligned to the scroll pane's center.
Is something like that available ?
Best wishes
Thorsten
Alex.From.Ohio.Java@gmail.com - 20 Mar 2008 15:01 GMT
> Hi,
> I need scroll pane which does not resize its child.
[quoted text clipped - 6 lines]
> Best wishes
> Thorsten
Just add additional container inside JScrollPane:
public class GUI {
public static void main(String[] args) {
JFrame frame=new JFrame();
frame.setSize(500, 400);
JButton button=new JButton("Click me");
button.setPreferredSize(new Dimension(200, 40));
JPanel panel=new JPanel();
panel.add(button);
JScrollPane scrollableArea = new JScrollPane(panel);
frame.add(scrollableArea);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Alex.
http://www.myjavaserver.com/~alexfromohio/
Thorsten Kiefer - 20 Mar 2008 20:44 GMT
>> Hi,
>> I need scroll pane which does not resize its child.
[quoted text clipped - 26 lines]
> Alex.
> http://www.myjavaserver.com/~alexfromohio/
Cool, Thanks !!!
Roedy Green - 21 Mar 2008 00:43 GMT
On Thu, 20 Mar 2008 12:06:27 +0100, Thorsten Kiefer
<thorstenkiefer@gmx.de> wrote, quoted or indirectly quoted someone who
said :
>I need scroll pane which does not resize its child.
>I.e. the child must always keep its preferred size.
You could use setPreferredSize setMinimumSize setMaximumSize on the
child and see if it honours your request.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com