public class GridBagLayouter extends Object
A typical usage pattern is:
    GridBagLayouter layouter = new GridBagLayouter( pane, GridBagLayouter.SCHEME3 );
    layouter.add( "Label:", false );
    layouter.add( new JComponent(), true );         // End of this line
    ... more components ...
    layouter.eatSpare();                            // End of all components
 | Modifier and Type | Field and Description | 
|---|---|
static int | 
SCHEME1
Simple row by row layout. 
 | 
static int | 
SCHEME2
Simple row by row layout, but this time with three components,
 weighted 0.15 to 0 to 0.85, so that most space is kept by right
 component. 
 | 
static int | 
SCHEME3
Simple row by row layout. 
 | 
static int | 
SCHEME4
Simple row by row layout, as in SCHEME3, but with the occasional
 component that fills vertically too. 
 | 
static int | 
SCHEME5
Simple row by row layout. 
 | 
| Constructor and Description | 
|---|
GridBagLayouter(Container container)
Create an instance with the default layout scheme (SCHEME1). 
 | 
GridBagLayouter(Container container,
               int scheme)
Create an instance with a given layout scheme. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
add(Component component,
   boolean complete)
Add a control using the current scheme. 
 | 
void | 
add(Component component,
   GridBagConstraints gbc)
Add a control using given GridBagContraints. 
 | 
void | 
add(String label)
Add a JLabel using the current scheme. 
 | 
void | 
add(String label,
   boolean complete)
Add a JLabel using the current scheme. 
 | 
void | 
eatLine()
Eat to end of current line. 
 | 
void | 
eatSpare()
Finish adding by "eating" all remaining space (makes components
 move to top of container). 
 | 
Container | 
getContainer()
Get the container we're adding to. 
 | 
void | 
setInsets(Insets insets)
Set the GridBagLayout Insets. 
 | 
public static final int SCHEME1
    label: [input component]
    label: [input component]
    ....
 public static final int SCHEME2
    [minor input component] label [main input component]
    [minor input component] label [main input component]
    ....
 public static final int SCHEME3
    label: [long text input component            ]
    label: [long text input component            ]
    ....
 public static final int SCHEME4
    label: [long text input component            ]
    label: [long text input component            ]
    [text/display area                           ]
    [....                                        ]
    [....                                        ]
    ....
 
 a filled area is indicated by a single item on a line.public static final int SCHEME5
 label        
 [input component] [input component]
 label        
 [input component] [input component]
    ....
 public GridBagLayouter(Container container)
container - the containerpublic GridBagLayouter(Container container, int scheme)
container - the containerscheme - one of the available schemes (SCHEME[1-]).public void add(String label, boolean complete)
label - the string for the JLabelcomplete - whether the line is now completedpublic void add(String label)
label - the string for the JLabelpublic void add(Component component, boolean complete)
component - the component to addcomplete - whether the line is now completedpublic void setInsets(Insets insets)
public void add(Component component, GridBagConstraints gbc)
public void eatLine()
public void eatSpare()
public Container getContainer()
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.