public class LabeledComponent extends LabeledComponentBase
Other components can be added to this container as usual. However, components
which are added using addMajorComponent
will be
accompanied by extra horizontal spacing (equal to the amount specified by
setSpacing
.
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
LabeledComponent(java.lang.String labelText)
Creates a new LabledContainer, with a label containing the specified text.
|
LabeledComponent(java.lang.String labelText,
java.awt.Component comp)
Creates a new LabledContainer, with a label containing the specified text
and an additional major component.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
addMajorComponent(java.awt.Component comp)
Adds a major component to this labeled component.
|
void |
addMajorComponent(java.awt.Component comp,
int idx)
Adds a major component to this labeled component at a specified location.
|
void |
dispose() |
java.util.ArrayList<java.lang.String> |
getActions() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
javax.swing.JLabel |
getLabel()
Returns the JLabel associated with this control.
|
void |
getLabelSpacing(LabelSpacing spacing) |
java.awt.Component |
getMainComponent() |
java.awt.Component |
getMajorComponent(int idx)
Gets the major component located at a specific index.
|
java.awt.Dimension |
getMaximumSize() |
java.awt.Dimension |
getMinimumSize() |
void |
getPreferredLabelSpacing(LabelSpacing spacing) |
int |
getSpacing()
Gets the spacing associated with this component.
|
int |
indexOfMajor(java.awt.Component comp)
Gets the index of a specified major component, or -1 if the component is
not present.
|
boolean |
isLabelStretchable() |
boolean |
isStretchable()
Returns true if this component is horizontally stretchable.
|
int |
numMajorComponents() |
int |
removeMajorComponent(java.awt.Component comp)
Removes the specified major component from this labeled component.
|
void |
setLabelSpacing(LabelSpacing spacing) |
void |
setLabelStretchable(boolean flexible) |
void |
setLabelText(java.lang.String text)
Sets the label text associated with this component.
|
void |
setSpacing(int m)
Sets the spacing associated with this component.
|
void |
setStretchable(boolean enable)
Specifies whether or not this component is horizontally stretchable.
|
getBackgroundColor, getLabelFontColor, getLabelText, getLeftInset, getProperty, isScanning, isSelected, setBackgroundColor, setLabelFontColor, setLabelFontColor, setScanning, setSelected
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getToolTipText, setToolTipText
public static PropertyList myProps
public LabeledComponent(java.lang.String labelText)
labelText
- optional text for this component's labelpublic LabeledComponent(java.lang.String labelText, java.awt.Component comp)
labelText
- optional text for this component's labelcomp
- major component to addpublic PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class LabeledComponentBase
public boolean isLabelStretchable()
public void setLabelStretchable(boolean flexible)
public boolean isStretchable()
setStretchable(boolean)
public void setStretchable(boolean enable)
enable
- if true, makes this component horizontally stretchableisStretchable()
public void setSpacing(int m)
addMajorComponent
.m
- new spacing value, in pixelsgetSpacing()
public int getSpacing()
setSpacing(int)
public java.awt.Component getMajorComponent(int idx)
idx
- index of the major componentaddMajorComponent(java.awt.Component)
public void addMajorComponent(java.awt.Component comp)
getSpacing
).comp
- component to addpublic void addMajorComponent(java.awt.Component comp, int idx)
getSpacing
).comp
- component to addidx
- location within the major component listpublic int numMajorComponents()
public int removeMajorComponent(java.awt.Component comp)
comp
- component to removeaddMajorComponent(java.awt.Component)
public int indexOfMajor(java.awt.Component comp)
public javax.swing.JLabel getLabel()
public java.awt.Component getMainComponent()
public void setLabelText(java.lang.String text)
setLabelText
in interface LabeledWidget
setLabelText
in class LabeledComponentBase
text
- new label textLabeledComponentBase.getLabelText()
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class javax.swing.JComponent
public void getLabelSpacing(LabelSpacing spacing)
public void setLabelSpacing(LabelSpacing spacing)
public void getPreferredLabelSpacing(LabelSpacing spacing)
public void dispose()
dispose
in interface Disposable
dispose
in class LabeledComponentBase
public java.util.ArrayList<java.lang.String> getActions()
getActions
in class LabeledComponentBase
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class LabeledComponentBase