Talk:FaqGuiControlArray

The easiest way to do this, is to create a JPanel component and then use a grid type layout to formulate the look of the components. You can then add this JPanel component into your GUI by placing it inside of a placeholder JPanel that you've already put into your GUI design.

For a simple list of components that is scrollable, and stacked from top to bottom, you can simply do something like

private JPanel buildList( JComponent comps[] ) {
    JPanel cp = new JPanel();
    BoxLayout bl = new BoxLayout( cp, BoxLayout.PAGE_AXIS );
    JPanel p = new JPanel();
    p.setLayout( new FlowLayout() );
    p.add( new JScrollPane( cp ) );
    for( JComponent c : comps ) {
        cp.add( c );
    }
    return p;
}

Then, after initComponents() is called by netbeans, you can call this method to get the JPanel that contains the components and then add the returned JPanel into the JPanel that you put in as the place holder.

With some minor changes, you could pass in that component to this method and have it build into that component directly too.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo