com.limegroup.gnutella.gui
Class LabeledComponent

java.lang.Object
  extended bycom.limegroup.gnutella.gui.LabeledComponent

public final class LabeledComponent
extends java.lang.Object

This class creates a standardized JPanel that includes a Component with a JLabel next to it.

The label can be placed to the left, to the right, on top, or on bottom of the Component depending on the parameters used in the constructor.


Field Summary
static int BOTTOM_CENTER
          Constant alignment key for aligning the label onthe bottom of the Component justified in the center.
static int BOTTOM_GLUE
          This will create a "glue" at the bottom of the panel, pushing the label/component pair to the top.
static int BOTTOM_LEFT
          Constant alignment key for aligning the label onthe bottom of the Component with left justification.
static int BOTTOM_RIGHT
          Constant alignment key for aligning the label on the bottom of the Component with right justification.
static int LEFT
          Constant alignment key for aligning the label to the left of the Component.
static int LEFT_GLUE
          This will create a "glue" at the left of the panel, pushing the label/component pair to the right.
static int NO_GLUE
          This will give the panel no glue, leaving the label/component pair in the middle.
static int RIGHT
          Constant alignment key for aligning the label to the right of the Component.
static int RIGHT_GLUE
          This will create a "glue" at the right of the panel, pushing the label/component pair to the right.
static int TOP_CENTER
          Constant alignment key for aligning the label on the top of the Component justified in the center.
static int TOP_GLUE
          This will create a "glue" at the top of the panel, pushing the label/component pair to the bottom.
static int TOP_LEFT
          Constant alignment key for aligning the label on the top of the Component with left justification.
static int TOP_RIGHT
          Constant alignment key for aligning the label on the top of the Component with right justification.
 
Constructor Summary
LabeledComponent(java.lang.String key, java.awt.Component comp)
          Constructs a JPanel with a label next to a field with standard spacing between them.
LabeledComponent(java.lang.String key, java.awt.Component comp, int glue)
          Constructs a JPanel with a label next to a field with standard spacing between them.
LabeledComponent(java.lang.String key, java.awt.Component comp, int alignment, int glue)
          Constructs a JPanel with a label next to a field with standard spacing between them.
 
Method Summary
 java.awt.Component getComponent()
          Returns the Component that contains the JLabel and its associated Component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Constant alignment key for aligning the label to the left of the Component.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Constant alignment key for aligning the label to the right of the Component.

See Also:
Constant Field Values

TOP_CENTER

public static final int TOP_CENTER
Constant alignment key for aligning the label on the top of the Component justified in the center.

See Also:
Constant Field Values

TOP_LEFT

public static final int TOP_LEFT
Constant alignment key for aligning the label on the top of the Component with left justification.

See Also:
Constant Field Values

TOP_RIGHT

public static final int TOP_RIGHT
Constant alignment key for aligning the label on the top of the Component with right justification.

See Also:
Constant Field Values

BOTTOM_CENTER

public static final int BOTTOM_CENTER
Constant alignment key for aligning the label onthe bottom of the Component justified in the center.

See Also:
Constant Field Values

BOTTOM_LEFT

public static final int BOTTOM_LEFT
Constant alignment key for aligning the label onthe bottom of the Component with left justification.

See Also:
Constant Field Values

BOTTOM_RIGHT

public static final int BOTTOM_RIGHT
Constant alignment key for aligning the label on the bottom of the Component with right justification.

See Also:
Constant Field Values

TOP_GLUE

public static final int TOP_GLUE
This will create a "glue" at the top of the panel, pushing the label/component pair to the bottom.

See Also:
Constant Field Values

BOTTOM_GLUE

public static final int BOTTOM_GLUE
This will create a "glue" at the bottom of the panel, pushing the label/component pair to the top.

See Also:
Constant Field Values

LEFT_GLUE

public static final int LEFT_GLUE
This will create a "glue" at the left of the panel, pushing the label/component pair to the right.

See Also:
Constant Field Values

RIGHT_GLUE

public static final int RIGHT_GLUE
This will create a "glue" at the right of the panel, pushing the label/component pair to the right.

See Also:
Constant Field Values

NO_GLUE

public static final int NO_GLUE
This will give the panel no glue, leaving the label/component pair in the middle.

See Also:
Constant Field Values
Constructor Detail

LabeledComponent

public LabeledComponent(java.lang.String key,
                        java.awt.Component comp)
Constructs a JPanel with a label next to a field with standard spacing between them.

This constructor places the label to the left of the Component.

Parameters:
key - the key for the text for the locale-specific label
comp - the component to put the label next to

LabeledComponent

public LabeledComponent(java.lang.String key,
                        java.awt.Component comp,
                        int glue)
Constructs a JPanel with a label next to a field with standard spacing between them.

This constructor places the label to the left of the Component.

Parameters:
key - the key for the text for the locale-specific label
comp - the component to put the label next to
glue - specifies the type of glue to add to the panel

LabeledComponent

public LabeledComponent(java.lang.String key,
                        java.awt.Component comp,
                        int alignment,
                        int glue)
Constructs a JPanel with a label next to a field with standard spacing between them.

This method allows for a great deal of customizability for the layout of the given component, such as different alignments of the label in relation to the Component as well as a glue on any of the four sides that forces the label/component pair to one side of the panel.

Parameters:
comp - the component to put the label next to
alignment - specifies the placement of the label in relation to the Component
glue - specifies the type of glue to add to the panel
Method Detail

getComponent

public java.awt.Component getComponent()
Returns the Component that contains the JLabel and its associated Component.

Returns:
the Component that contains the JLabel and the Component next to it