org.dishevelled.layout
Class LabelFieldPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.dishevelled.layout.LabelFieldPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class LabelFieldPanel
extends JPanel

Label field panel.

Version:
$Revision$ $Date$
Author:
Michael Heuer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LabelFieldPanel()
          Create a new label field panel.
 
Method Summary
 Component add(Component component)
          
 Component add(Component component, int index)
          
 void add(Component component, Object constraints)
          
 void add(Component component, Object constraints, int index)
          
 Component add(String name, Component component)
          
 void addField(JComponent field)
          Add the specified field to this label field panel.
 void addField(JLabel label, JComponent field)
          Add the specified label and field to this label field panel.
 void addField(String text, JComponent field)
          Add the specified label and field to this label field panel.
 void addField(String labelText, String fieldText)
          Add the specified field to this label field panel.
 void addFinalField(JComponent field)
          Add the specified final field to this label field panel, that is a field that stretches horizontally across both the label and field columns and stretches vertically to cover space left at the bottom of this container.
 void addFinalSpacing()
          Add final spacing to this label field panel, that is spacing that stretches vertically to cover space left at the bottom of this container.
 void addFinalSpacing(int spacing)
          Add final spacing to this label field panel of at least the specified number of pixels, that is spacing that stretches vertically to cover space left at the bottom of this container.
 void addLabel(JLabel label)
          Add the specified label to this label field panel.
 void addLabel(String text)
          Add the specified label to this label field panel.
 void addSpacing(int spacing)
          Add spacing to this label field panel of at least the specified number of pixels.
 float getFieldPercent()
          Return the percentage of the width of this label field panel to use for fields.
 float getLabelPercent()
          Return the percentage of the width of this label field panel to use for labels.
 void setFieldPercent(float fieldPercent)
          Set the percentage of the width of this label field panel to use for fields to fieldPercent.
 void setLabelPercent(float labelPercent)
          Set the percentage of the width of this label field panel to use for labels to labelPercent.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelFieldPanel

public LabelFieldPanel()
Create a new label field panel.

Method Detail

getLabelPercent

public final float getLabelPercent()
Return the percentage of the width of this label field panel to use for labels.

Returns:
the percentage of the width of this label field panel to use for labels

setLabelPercent

public final void setLabelPercent(float labelPercent)
Set the percentage of the width of this label field panel to use for labels to labelPercent. The sum of the label and field percentages must be less than 1.0f.

Parameters:
labelPercent - the percentage of the width of this label field panel to use for labels, must be >= 0.0f and <= 1.0f

getFieldPercent

public final float getFieldPercent()
Return the percentage of the width of this label field panel to use for fields.

Returns:
the percentage of the width of this label field panel to use for fields

setFieldPercent

public final void setFieldPercent(float fieldPercent)
Set the percentage of the width of this label field panel to use for fields to fieldPercent. The sum of the label and field percentages must be less than or equal to 1.0f.

Parameters:
fieldPercent - the percentage of the width of this label field panel to use for fields, must be >= 0.0f and <= 1.0f

addLabel

public final void addLabel(String text)
Add the specified label to this label field panel.

Parameters:
text - label text

addLabel

public final void addLabel(JLabel label)
Add the specified label to this label field panel.

Parameters:
label - label to add, must not be null

addField

public final void addField(JComponent field)
Add the specified field to this label field panel.

Parameters:
field - field to add, must not be null

addField

public final void addField(String labelText,
                           String fieldText)
Add the specified field to this label field panel.

Parameters:
labelText - label text
fieldText - field text

addField

public final void addField(String text,
                           JComponent field)
Add the specified label and field to this label field panel.

Parameters:
text - label text
field - field to add, must not be null

addField

public final void addField(JLabel label,
                           JComponent field)
Add the specified label and field to this label field panel.

Parameters:
label - label to add, must not be null
field - field to add, must not be null

addSpacing

public final void addSpacing(int spacing)
Add spacing to this label field panel of at least the specified number of pixels.

Parameters:
spacing - number of pixels, must be >= 0

addFinalSpacing

public final void addFinalSpacing()
Add final spacing to this label field panel, that is spacing that stretches vertically to cover space left at the bottom of this container. Only one final component may be added to this label field panel.

Throws:
IllegalStateException - if a final component has already been added to this label field panel

addFinalSpacing

public final void addFinalSpacing(int spacing)
Add final spacing to this label field panel of at least the specified number of pixels, that is spacing that stretches vertically to cover space left at the bottom of this container. Only one final component may be added to this label field panel.

Parameters:
spacing - minimum number of pixels, must be >= 0
Throws:
IllegalStateException - if a final component has already been added to this label field panel

addFinalField

public final void addFinalField(JComponent field)
Add the specified final field to this label field panel, that is a field that stretches horizontally across both the label and field columns and stretches vertically to cover space left at the bottom of this container. Only one final component may be added to this label field panel.

Parameters:
field - field to add, must not be null
Throws:
IllegalStateException - if a final component has already been added to this label field panel

add

public final Component add(Component component)

Overrides:
add in class Container

add

public final Component add(String name,
                           Component component)

Overrides:
add in class Container

add

public final Component add(Component component,
                           int index)

Overrides:
add in class Container

add

public final void add(Component component,
                      Object constraints)

Overrides:
add in class Container

add

public final void add(Component component,
                      Object constraints,
                      int index)

Overrides:
add in class Container


Copyright (c) 2003-2011 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).