Package hec.gfx2d
Class G2dLabel
- All Implemented Interfaces:
G2dToolbarListener,ImageObserver,MenuContainer,Serializable,Observer,Accessible
A component that displays the label of an Axis.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class hec.gfx2d.G2dComponent
G2dComponent.DefaultPreferredSizeProvider, G2dComponent.EditPropertyListenerNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class hec.gfx2d.G2dComponent
_parent, _popupMenu, BOTTOM, LEFT, RIGHT, TOPFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertiesOKListener(ActionListener listener) voidprotected voiddrawBorder(Graphics2D g, Dimension dim) voidintget the text alignment for this G2dLabelget the text alignment for this G2dLabelget the Background color of this label as a Stringget the border style for this G2dLabel as a Stringfloatget the border weight for this G2dLabelget the Fill color of this label as a Colorget the Fill color of this label as a Stringintget the Fill Pattern for this G2dLabelget the Fill Pattern for this G2dLabel as a Stringget the font family for this labelintget the Font Size for this labelint[]get the fonts sizes used by this labelGets font information in the form of a font string (([Name],[Style],[Size]))intget the font style for this labelreturn the Font Style as a Stringget the Foreground color of this label as a Stringprotected FontgetIcon()return the Icon that this Label displaysreturn the path to the Icon file that this label displaysprotected StringCompute the preferred size based on label size and orientationintget the text rotation for this G2dLabelintget the spacing around this labelgetText()Object[]booleanbooleanDeprecated.booleanget whether the background is visiblebooleanDeprecated.booleanget whether the label border is visiblebooleanobjectPopupMenu(LocalPt pt, int modifiers) voidPaints the contents of the panel.voidsetAlignment(String alignment) set the text alignment for this G2dLabelvoidvoidsetBackground(String colorString) voidsetBackgroundVisible(boolean state) set the background visibilityvoidsetBorderColor(String colorString) set the border color for this G2dLabelvoidsetBorderStyle(String style) set the border style for this G2dLabelvoidsetBorderVisible(boolean state) set the border visibilityvoidsetBorderWeight(float weight) set the border weight for this G2dLabelvoidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidset the Fill color of this labelvoidsetFillColor(String colorString) set the Fill color of this labelvoidsetFillPattern(String pattern) set the background fill pattern for this labelvoidSets the font and font information from a Font objectvoidSets font information from a font string ([Name],[Style],[Size])voidsetFontFamily(String fam) voidsetFontInfo(Font f) Sets font information from a Font objectvoidsetFontSize(int sz) set the Font Size of this label toszvoidsetFontSizes(int sz, int tiny, int min, int max) set the font sizes for this labelvoidsetFontStyle(int style) voidsetFontStyle(String style) set the font style for this G2dLabelvoidsetForeground(String colorString) voidSets the icon to display.voidvoidvoidsetRotation(int rotation) set the text rotation for this G2dLabelvoidsetSpacing(int space) set the spacing around this labelvoidset the text for this labelvoidvoidsetUseFontScaling(boolean b) voidupdate(Observable o, Object arg) Methods inherited from class hec.gfx2d.G2dComponent
getG2dPanel, getMouseAdapter, getPreferredSize, getToolTipText, paint, paintComponent, paintGfx, pointerOver, setG2dPanel, setMouseAdapter, setMouseAdapter, setPreferredSizeProviderMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, 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, transferFocusDownCycle, validate, validateTreeMethods 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
ALIGN_LEFT
public static final int ALIGN_LEFT- See Also:
-
ALIGN_CENTER
public static final int ALIGN_CENTER- See Also:
-
ALIGN_RIGHT
public static final int ALIGN_RIGHT- See Also:
-
ROTATE_0
public static final int ROTATE_0- See Also:
-
ROTATE_90
public static final int ROTATE_90- See Also:
-
ROTATE_180
public static final int ROTATE_180- See Also:
-
ROTATE_270
public static final int ROTATE_270- See Also:
-
-
Constructor Details
-
G2dLabel
-
G2dLabel
-
-
Method Details
-
getPopupMenuTitle
-
createPopupMenu
public void createPopupMenu()- Overrides:
createPopupMenuin classG2dComponent
-
update
-
setProperties
-
getProperties
-
setUseFontScaling
public void setUseFontScaling(boolean b) -
getUseFontScaling
public boolean getUseFontScaling() -
getFontString
Gets font information in the form of a font string (([Name],[Style],[Size]))- Returns:
- The font string
-
setFont
Sets the font and font information from a Font object- Overrides:
setFontin classJComponent- Parameters:
f- The Font object
-
setFont
Sets font information from a font string ([Name],[Style],[Size])- Parameters:
fontString- The font string
-
setFontInfo
Sets font information from a Font object- Parameters:
f- The Font object
-
setFontSize
public void setFontSize(int sz) set the Font Size of this label tosz- Parameters:
sz- the new font size
-
getFontSize
public int getFontSize()get the Font Size for this label- Returns:
- the Font Size
-
setFontSizes
public void setFontSizes(int sz, int tiny, int min, int max) set the font sizes for this label- Parameters:
sz- the normal font sizetiny- the tiny font sizemin- the minimum font sizemax- the maximum font size
-
getFontSizes
public int[] getFontSizes()get the fonts sizes used by this label- Returns:
- [0] the normal font size
[1] the tiny font size
[2] the min font size
[3] the max font size
-
setFontStyle
set the font style for this G2dLabel- Parameters:
style- is one of the four case-insensitive strings:"PLAIN","BOLD","BOLDITALIC", or"ITALIC",
-
getFontStyle
public int getFontStyle()get the font style for this label- Returns:
- the font style
-
getFontStyleString
return the Font Style as a String- Returns:
- one of the four strings:
"PLAIN","BOLD","BOLDITALIC", or"ITALIC",
-
setFontStyle
public void setFontStyle(int style) -
setFontFamily
-
getFontFamily
get the font family for this label- Returns:
- the font family
-
setIcon
Sets the icon to display.- Parameters:
iconPath- the path to the icon
-
setIcon
-
getIcon
return the Icon that this Label displays- Returns:
- the Icon
-
getIconPath
return the path to the Icon file that this label displays- Returns:
- the Icon's path
-
setText
set the text for this label- Parameters:
txt- the new text
-
setText
-
getText
-
getMinimumSize
- Overrides:
getMinimumSizein classJComponent
-
getMinimumSize
-
getPreferredSizeLocal
Compute the preferred size based on label size and orientation- Overrides:
getPreferredSizeLocalin classG2dComponent- Returns:
- Dimension preferred sized of the component
-
getPreferredSize
-
getTextSubstitutionObjects
-
paintGfx
Description copied from class:G2dComponentPaints the contents of the panel.- Overrides:
paintGfxin classG2dComponent
-
drawBorder
-
getG2dFont
-
objectPopupMenu
- Overrides:
objectPopupMenuin classG2dComponent
-
addPropertiesOKListener
-
editProperties
public void editProperties()- Overrides:
editPropertiesin classG2dComponent
-
setBackground
- Overrides:
setBackgroundin classJComponent
-
setBackground
- Parameters:
colorString- the color to set the background to
-
getBackgroundString
get the Background color of this label as a String- Returns:
- the Background color string
-
setForeground
- Parameters:
colorString- the color to set the foreground to
-
getForegroundString
get the Foreground color of this label as a String- Returns:
- the Foreground color string
-
setFillColor
set the Fill color of this label- Parameters:
c- the fill color as a Color
-
setFillColor
set the Fill color of this label- Parameters:
colorString- the fill color as a String
-
getFillColor
get the Fill color of this label as a Color- Returns:
- the Fill color
-
getFillColorString
get the Fill color of this label as a String- Returns:
- the Fill color string
-
setBorderVisible
public void setBorderVisible(boolean state) set the border visibility- Parameters:
state-
-
setDrawBorderOn
Deprecated.set the border to draw -
setDrawBorderOff
Deprecated.set the border not to draw -
isBorderVisible
public boolean isBorderVisible()get whether the label border is visible- Returns:
- whether the label border is visible
-
isBorderDrawn
Deprecated.get whether the label draws it's border or not- Returns:
-
setBorderColor
set the border color for this G2dLabel- Parameters:
colorString- the border color
-
setBackgroundVisible
public void setBackgroundVisible(boolean state) set the background visibility- Parameters:
state-
-
setDrawBackgroundOn
Deprecated.set the background to draw -
setDrawBackgroundOff
Deprecated.set the background not to draw -
isBackgroundVisible
public boolean isBackgroundVisible()get whether the background is visible- Returns:
- whether the background is visible
-
isBackgroundDrawn
Deprecated.get whether the background is drawn or not- Returns:
-
setBorderWeight
public void setBorderWeight(float weight) set the border weight for this G2dLabel- Parameters:
weight- the border weight
-
getBorderWeight
public float getBorderWeight()get the border weight for this G2dLabel- Returns:
- the border weight
-
setFillPattern
set the background fill pattern for this label- Parameters:
pattern- the fill pattern- See Also:
-
getFillPatternString
get the Fill Pattern for this G2dLabel as a String- Returns:
- the fill pattern String
-
getFillPattern
public int getFillPattern()get the Fill Pattern for this G2dLabel- Returns:
- the fill pattern
-
setAlignment
set the text alignment for this G2dLabel- Parameters:
alignment- the alignment one of "left", "right" or "center"
-
getAlignmentString
get the text alignment for this G2dLabel- Returns:
- one of the three strings:
"left","right"or"center",
-
getAlignment
public int getAlignment()get the text alignment for this G2dLabel- Overrides:
getAlignmentin classG2dComponent- Returns:
- the text alignment
-
setRotation
public void setRotation(int rotation) set the text rotation for this G2dLabel- Parameters:
rotation- the rotation. one of 0, 90, 180, 270
-
getRotation
public int getRotation()get the text rotation for this G2dLabel- Returns:
- the text rotation
-
setSpacing
public void setSpacing(int space) set the spacing around this label- Parameters:
space- the spacing
-
getSpacing
public int getSpacing()get the spacing around this label- Returns:
- the spacing
-
setBorderStyle
set the border style for this G2dLabel- Parameters:
style- the border style
-
getBorderStyleString
get the border style for this G2dLabel as a String- Returns:
- the border style string
-