org.jtheque.core.utils.ui
Class PanelBuilder

java.lang.Object
  extended by org.jtheque.core.utils.ui.PanelBuilder

public final class PanelBuilder
extends java.lang.Object

A panel builder.

Author:
Baptiste Wicht

Field Summary
static int BOLD
           
static int ITALIC
           
 
Constructor Summary
PanelBuilder()
          Construct a new PanelBuilder.
PanelBuilder(javax.swing.JPanel panel)
          Construct a new panel builder.
 
Method Summary
<T extends java.awt.Component>
T
add(T component, java.lang.Object constraints)
          Add a component to the panel with the specified constraints.
 javax.swing.JButton addButton(javax.swing.Action action, java.lang.Object constraints)
          Add a button to the panel.
 void addButtonBar(java.lang.Object constraints, javax.swing.Action... actions)
          Add a button bar.
 javax.swing.JComboBox addComboBox(javax.swing.DefaultComboBoxModel model, java.lang.Object constraints)
          Add a combo box.
 javax.swing.JCheckBox addI18nCheckBox(java.lang.String key, java.lang.Object constraints)
          Add an internationalized check box.
 JThequeLabel addI18nLabel(java.lang.String key, java.lang.Object constraints)
          Add an internationalized label to the panel.
 void addI18nSeparator(java.lang.String key, java.lang.Object constraints)
          Add an internationalized separator.
 JThequeLabel addInternationalizedLabel(java.lang.String key, java.lang.Object constraints, int style)
          Add an internationalized label with a specified style to the panel.
 void addLabel(java.lang.String text, java.lang.Object constraints)
          Add a label to the panel.
 javax.swing.JList addList(javax.swing.ListModel model, javax.swing.ListCellRenderer renderer, java.lang.Object constraints)
          Add a Jlist with the specified model.
 PanelBuilder addPanel(java.lang.Object constraints)
          Add a panel to the panel.
 void addScrolled(javax.swing.JComponent view, java.lang.Object constraints)
          Add a scrolled component.
 void addScrolledTextArea(java.lang.String text, java.lang.Object constraints)
          Add a scrolled text area.
 java.lang.Object gbcSet(int x, int y)
          Create a new layout constraints.
 java.lang.Object gbcSet(int x, int y, int fill)
          Create a new layout constraints.
 java.lang.Object gbcSet(int x, int y, int fill, int anchor)
          Create a new layout constraints.
 java.lang.Object gbcSet(int x, int y, int fill, int anchor, double weightx, double weighty)
          Create a new layout constraints.
 java.lang.Object gbcSet(int x, int y, int fill, int width, int height)
          Create a new layout constraints.
 java.lang.Object gbcSet(int x, int y, int fill, int anchor, int width, int height)
          Create a new layout constraints.
 java.lang.Object gbcSet(int x, int y, int fill, int anchor, int width, int height, double weightx, double weighty)
          Create a new layout constraints.
 javax.swing.JComponent getPanel()
          Return the builded panel.
 void setDefaultInsets(java.awt.Insets defaultInsets)
          Set the default insets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOLD

public static final int BOLD
See Also:
Constant Field Values

ITALIC

public static final int ITALIC
See Also:
Constant Field Values
Constructor Detail

PanelBuilder

public PanelBuilder()
Construct a new PanelBuilder.


PanelBuilder

public PanelBuilder(javax.swing.JPanel panel)
Construct a new panel builder.

Parameters:
panel - The panel to build.
Method Detail

add

public <T extends java.awt.Component> T add(T component,
                                            java.lang.Object constraints)
Add a component to the panel with the specified constraints.

Type Parameters:
T - The type of component.
Parameters:
component - The component to add.
constraints - The constraints to use to add to the panel.
Returns:
The added component.

addComboBox

public javax.swing.JComboBox addComboBox(javax.swing.DefaultComboBoxModel model,
                                         java.lang.Object constraints)
Add a combo box.

Parameters:
model - The combobox model.
constraints - The constraints to use to add to the panel.
Returns:
The added JComboBox.

addI18nCheckBox

public javax.swing.JCheckBox addI18nCheckBox(java.lang.String key,
                                             java.lang.Object constraints)
Add an internationalized check box.

Parameters:
key - The internationalization key.
constraints - The constraints to use to add to the panel.
Returns:
The added JCheckBox.

addList

public javax.swing.JList addList(javax.swing.ListModel model,
                                 javax.swing.ListCellRenderer renderer,
                                 java.lang.Object constraints)
Add a Jlist with the specified model.

Parameters:
model - The model to use.
renderer - The list renderer.
constraints - The constraints to use to add to the panel.
Returns:
The added JList.

addButton

public javax.swing.JButton addButton(javax.swing.Action action,
                                     java.lang.Object constraints)
Add a button to the panel.

Parameters:
action - The action to use with the button.
constraints - The constraints to use to add to the panel.
Returns:
The added button.

addLabel

public void addLabel(java.lang.String text,
                     java.lang.Object constraints)
Add a label to the panel.

Parameters:
text - The text of the label.
constraints - The constraints to use to add to the panel.

addI18nLabel

public JThequeLabel addI18nLabel(java.lang.String key,
                                 java.lang.Object constraints)
Add an internationalized label to the panel.

Parameters:
key - The i18n key.
constraints - The constraints to use to add to the panel.
Returns:
The added label.

addInternationalizedLabel

public JThequeLabel addInternationalizedLabel(java.lang.String key,
                                              java.lang.Object constraints,
                                              int style)
Add an internationalized label with a specified style to the panel.

Parameters:
key - The i18n key.
constraints - The constraints to use to add to the panel.
style - The font style.
Returns:
The added label.

addScrolledTextArea

public void addScrolledTextArea(java.lang.String text,
                                java.lang.Object constraints)
Add a scrolled text area.

Parameters:
text - The text of the text area.
constraints - The constraints to use to add to the panel.

addScrolled

public void addScrolled(javax.swing.JComponent view,
                        java.lang.Object constraints)
Add a scrolled component.

Parameters:
view - The view.
constraints - The constraints to use to add to the panel.

addI18nSeparator

public void addI18nSeparator(java.lang.String key,
                             java.lang.Object constraints)
Add an internationalized separator.

Parameters:
key - The title key.
constraints - The constraints to use to add to the panel.

addButtonBar

public void addButtonBar(java.lang.Object constraints,
                         javax.swing.Action... actions)
Add a button bar.

Parameters:
constraints - The constraints to use to add to the panel.
actions - The actions to add to the button bar.

addPanel

public PanelBuilder addPanel(java.lang.Object constraints)
Add a panel to the panel.

Parameters:
constraints - The constraints to use to add to the panel.
Returns:
The builder of the intern panel builder.

getPanel

public javax.swing.JComponent getPanel()
Return the builded panel.

Returns:
The builded panel.

setDefaultInsets

public void setDefaultInsets(java.awt.Insets defaultInsets)
Set the default insets.

Parameters:
defaultInsets - The default insets.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y,
                               int fill,
                               int anchor,
                               double weightx,
                               double weighty)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
fill - The fill constraint.
anchor - The anchor constraint.
weightx - The weight in x axis.
weighty - The weight in y axis.
Returns:
The layout constraints.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y,
                               int fill,
                               int anchor,
                               int width,
                               int height,
                               double weightx,
                               double weighty)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
fill - The fill constraint.
anchor - The anchor constraint.
width - The col span.
height - The row span.
weightx - The weight in x axis.
weighty - The weight in y axis.
Returns:
The layout constraints.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y,
                               int fill,
                               int anchor,
                               int width,
                               int height)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
fill - The fill constraint.
anchor - The anchor constraint.
width - The col span.
height - The row span.
Returns:
The layout constraints.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y,
                               int fill,
                               int width,
                               int height)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
fill - The fill constraint.
width - The col span.
height - The row span.
Returns:
The layout constraints.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y,
                               int fill,
                               int anchor)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
fill - The fill constraint.
anchor - The anchor constraint.
Returns:
The layout constraints.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y,
                               int fill)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
fill - The fill constraint.
Returns:
The layout constraints.

gbcSet

public java.lang.Object gbcSet(int x,
                               int y)
Create a new layout constraints.

Parameters:
x - The x position on the grid.
y - The y position on the grid.
Returns:
The layout constraints.


Copyright © 2009 JTheque. All Rights Reserved.