Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Trying to add a JScrollPane for Multiple Checkboxes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to add a JScrollPane for Multiple Checkboxes



On 03.07.2004 18:10 Uhr, "gohaku" <email@hidden> wrote:

> Hi everyone,
> In my program, checkboxes are created on the fly and usually overflow in
> a JPanel component. I tried making that JPanel scrollable but have not
> been
> able to do so.
>
> Below is an example of what I'm trying to implement:
> //
> [...]
> public ScrollTest()
> {
> super("ScrollPane Test for Multiple Checkboxes");
> setSize(640,480);
> checkPanel = new JPanel();
> checkPanel.setLayout(new GridLayout(100,1));
> for(int i = 0; i < 100; i++)
> {
> checkPanel.add(new JCheckBox("Checkbox "+i));
> }
> ScrollArea = new JScrollPane(checkPanel);
>
> ScrollArea.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALW
> AYS);
> ScrollArea.setSize(new Dimension(1000,1240));
> this.getContentPane().add(ScrollArea,BorderLayout.NORTH);
> ...

You do not set BorderLayout for your ContentPane, adding without
BorderLayout.NORTH gives the wanted result.


Lars
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Trying to add a JScrollPane for Multiple Checkboxes (From: gohaku <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.