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.EditPropertyListener
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
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from class hec.gfx2d.G2dComponent
_parent, _popupMenu, BOTTOM, LEFT, RIGHT, TOP
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertiesOKListener
(ActionListener listener) void
protected void
drawBorder
(Graphics2D g, Dimension dim) void
int
get 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 Stringfloat
get the border weight for this G2dLabelget the Fill color of this label as a Colorget the Fill color of this label as a Stringint
get the Fill Pattern for this G2dLabelget the Fill Pattern for this G2dLabel as a Stringget the font family for this labelint
get 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]))int
get the font style for this labelreturn the Font Style as a Stringget the Foreground color of this label as a Stringprotected Font
getIcon()
return the Icon that this Label displaysreturn the path to the Icon file that this label displaysprotected String
Compute the preferred size based on label size and orientationint
get the text rotation for this G2dLabelint
get the spacing around this labelgetText()
Object[]
boolean
boolean
Deprecated.boolean
get whether the background is visibleboolean
Deprecated.boolean
get whether the label border is visibleboolean
objectPopupMenu
(LocalPt pt, int modifiers) void
Paints the contents of the panel.void
setAlignment
(String alignment) set the text alignment for this G2dLabelvoid
void
setBackground
(String colorString) void
setBackgroundVisible
(boolean state) set the background visibilityvoid
setBorderColor
(String colorString) set the border color for this G2dLabelvoid
setBorderStyle
(String style) set the border style for this G2dLabelvoid
setBorderVisible
(boolean state) set the border visibilityvoid
setBorderWeight
(float weight) set the border weight for this G2dLabelvoid
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
set the Fill color of this labelvoid
setFillColor
(String colorString) set the Fill color of this labelvoid
setFillPattern
(String pattern) set the background fill pattern for this labelvoid
Sets the font and font information from a Font objectvoid
Sets font information from a font string ([Name],[Style],[Size])void
setFontFamily
(String fam) void
setFontInfo
(Font f) Sets font information from a Font objectvoid
setFontSize
(int sz) set the Font Size of this label tosz
void
setFontSizes
(int sz, int tiny, int min, int max) set the font sizes for this labelvoid
setFontStyle
(int style) void
setFontStyle
(String style) set the font style for this G2dLabelvoid
setForeground
(String colorString) void
Sets the icon to display.void
void
void
setRotation
(int rotation) set the text rotation for this G2dLabelvoid
setSpacing
(int space) set the spacing around this labelvoid
set the text for this labelvoid
void
setUseFontScaling
(boolean b) void
update
(Observable o, Object arg) Methods inherited from class hec.gfx2d.G2dComponent
getG2dPanel, getMouseAdapter, getPreferredSize, getToolTipText, paint, paintComponent, paintGfx, pointerOver, setG2dPanel, setMouseAdapter, setMouseAdapter, setPreferredSizeProvider
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, 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, update
Methods 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, 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, 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:
createPopupMenu
in 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:
setFont
in 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:
getMinimumSize
in classJComponent
-
getMinimumSize
-
getPreferredSizeLocal
Compute the preferred size based on label size and orientation- Overrides:
getPreferredSizeLocal
in classG2dComponent
- Returns:
- Dimension preferred sized of the component
-
getPreferredSize
-
getTextSubstitutionObjects
-
paintGfx
Description copied from class:G2dComponent
Paints the contents of the panel.- Overrides:
paintGfx
in classG2dComponent
-
drawBorder
-
getG2dFont
-
objectPopupMenu
- Overrides:
objectPopupMenu
in classG2dComponent
-
addPropertiesOKListener
-
editProperties
public void editProperties()- Overrides:
editProperties
in classG2dComponent
-
setBackground
- Overrides:
setBackground
in 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:
getAlignment
in 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
-