Class GbcMaker

java.lang.Object
  extended by GbcMaker

public class GbcMaker
extends java.lang.Object

A "factory" to create GridBagConstraints. To have the same border between GUI elements an at the outside of a GridBagLayout the insets on inner borders must be half of the insets on outer borders.


Constructor Summary
GbcMaker(int rows, int columns, int b)
          Construct a new GbcMaker
 
Method Summary
 java.awt.GridBagConstraints create(int y, int x, int h, int w)
          Create a new GridBagConstraints.
 java.awt.GridBagConstraints createDummyGbc(int y, int x, int h, int w)
          Create GridBagConstraints for a dummy panel (see above).
 javax.swing.JPanel createDummyPanel()
          Create a dummy JPanel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GbcMaker

public GbcMaker(int rows,
                int columns,
                int b)
Construct a new GbcMaker

Parameters:
rows - The number of rows in the GridBagLayout.
columns - The number of columns in the GridBagLayout.
b - The GUI element border in pixels.
Method Detail

create

public java.awt.GridBagConstraints create(int y,
                                          int x,
                                          int h,
                                          int w)
Create a new GridBagConstraints.

Parameters:
y - The row in which the GUI element starts.
x - The column in which the GUI element starts.
h - The height of the GUI element in rows.
w - The width of the GUI element in columns.
Returns:
The GridBagConstraints to use for the GUI element.

createDummyPanel

public javax.swing.JPanel createDummyPanel()
Create a dummy JPanel. A dummy panel can be used as a sink for free space.

Returns:
A JPanel eating free space when growing the enclosing container.

createDummyGbc

public java.awt.GridBagConstraints createDummyGbc(int y,
                                                  int x,
                                                  int h,
                                                  int w)
Create GridBagConstraints for a dummy panel (see above).

Parameters:
y - The start row of the panel.
x - The start column of the panel.
h - The panel height in rows.
w - The panel width in columns.
Returns:
The GridBagConstraints for the dummy panel.