org.jplot2d.element
Interface PComponent
-
- All Superinterfaces:
- Element
- All Known Subinterfaces:
- Annotation, AnnotationEx, Axis, AxisEx, ComponentEx, ContainerEx, CoordinateAnnotation, CoordinateAnnotationEx, Graph, GraphEx, HLineAnnotation, HLineAnnotationEx, HStripAnnotation, HStripAnnotationEx, ImageGraph, ImageGraphEx, Layer, LayerEx, Legend, LegendEx, LineAnnotation, MovableComponent, Plot, PlotEx, PointAnnotation, PointAnnotationEx, RectangleAnnotation, RectangleAnnotationEx, RGBImageGraph, RGBImageGraphEx, StripAnnotation, SymbolAnnotation, SymbolAnnotationEx, TextComponent, Title, TitleEx, VLineAnnotation, VLineAnnotationEx, VStripAnnotation, VStripAnnotationEx, XYGraph, XYGraphEx
- All Known Implementing Classes:
- AnnotationImpl, AxisImpl, ComponentImpl, ContainerImpl, CoordinateAnnotationImpl, GraphImpl, HLineAnnotationImpl, HStripAnnotationImpl, ImageGraphImpl, LayerImpl, LegendImpl, PlotImpl, PointAnnotationImpl, RectangleAnnotationImpl, RGBImageGraphImpl, SymbolAnnotationImpl, TitleImpl, VLineAnnotationImpl, VStripAnnotationImpl, XYGraphImpl
public interface PComponent extends Element
A component is an object having a graphical representation that can be drawn on the renderer and that can interact with the user.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description java.awt.geom.Rectangle2DgetBounds()Returns the paper bounds relative to its location.java.awt.ColorgetColor()Gets the foreground color of this component.java.awt.FontgetEffectiveFont()Returns the effective font of this component.java.lang.StringgetFontName()Returns the name of the font.floatgetFontScale()Returns the scale apply to parent's font size when font size is NaN.floatgetFontSize()Returns the Font size.intgetFontStyle()Returns the style of the font.java.awt.geom.Point2DgetLocation()Returns the location of this component.PaperTransformgetPaperTransform()Returns the paper transform of this component, which can be used to convert between device coordinate and paper coordinate of this component.PComponentgetParent()Gets the parent of this component.java.awt.geom.Rectangle2DgetSelectableBounds()Returns the selectable bounds relative to its location.java.awt.geom.Dimension2DgetSize()Returns the paper size of this component.intgetZOrder()Returns the z-order of this component.booleanisCacheable()Returnstrueif this component has its own rendering cache.booleanisSelectable()Returnstrueif the component is selectable by mouse.booleanisVisible()Determines whether this component should be visible when its parent is visible.voidsetCacheable(boolean mode)Sets if this component has its own rendering cache.voidsetColor(java.awt.Color c)Sets the foreground color of this component.voidsetFont(java.awt.Font font)Sets the font name, style and size for this component.voidsetFontName(java.lang.String name)Apply the new font with the given namevoidsetFontScale(float scale)Sets the scale apply to parent's font size when font size is NaN.voidsetFontSize(float size)Sets a new size of the string.voidsetFontStyle(int style)Apply a new style to the font.voidsetSelectable(boolean selectable)Set the selectable property.voidsetVisible(boolean b)Shows or hides this component depending on the value of parameterb.voidsetZOrder(int z)Sets the z-order of this component.-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment, getId
-
-
-
-
Method Detail
-
getParent
PComponent getParent()
Gets the parent of this component.
-
isVisible
boolean isVisible()
Determines whether this component should be visible when its parent is visible. Components are initially visible.- Returns:
trueif the component is visible,falseotherwise- See Also:
setVisible(boolean)
-
setVisible
void setVisible(boolean b)
Shows or hides this component depending on the value of parameterb.- Parameters:
b- iftrue, shows this component; otherwise, hides this component- See Also:
isVisible()
-
isCacheable
boolean isCacheable()
Returnstrueif this component has its own rendering cache.- Returns:
- the cache mode of this component
-
setCacheable
void setCacheable(boolean mode)
Sets if this component has its own rendering cache.- Parameters:
mode- the cache mode
-
isSelectable
boolean isSelectable()
Returnstrueif the component is selectable by mouse. Only selectable component can be movable.- Returns:
trueif selectable
-
setSelectable
void setSelectable(boolean selectable)
Set the selectable property.- Parameters:
select- iftrueobject is selectable
-
getZOrder
int getZOrder()
Returns the z-order of this component.- Returns:
- the z-order of this component
-
setZOrder
void setZOrder(int z)
Sets the z-order of this component. The component with higher z-order is on top.- Parameters:
z- the z-order value
-
getColor
java.awt.Color getColor()
Gets the foreground color of this component.- Returns:
- this component's foreground color; if this component does not have a foreground color, the foreground color of its parent is returned
- See Also:
setColor(java.awt.Color)
-
setColor
void setColor(java.awt.Color c)
Sets the foreground color of this component.- Parameters:
c- the color to become this component's foreground color; if this parameter isnullthen this component will inherit the foreground color of its parent- See Also:
getColor()
-
getFontName
java.lang.String getFontName()
Returns the name of the font.- Returns:
- the name of the font.
-
setFontName
void setFontName(java.lang.String name)
Apply the new font with the given name- Parameters:
name- the font name.
-
getFontStyle
int getFontStyle()
Returns the style of the font. The style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.- Returns:
- the style of the font
- See Also:
Font
-
setFontStyle
void setFontStyle(int style)
Apply a new style to the font. The style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.- Parameters:
style- the style to apply- See Also:
Font
-
getFontSize
float getFontSize()
Returns the Font size.- Returns:
- the font size.
-
setFontSize
void setFontSize(float size)
Sets a new size of the string.- Parameters:
size- the new size of the font.
-
getFontScale
float getFontScale()
Returns the scale apply to parent's font size when font size is NaN.- Returns:
- the font scale.
-
setFontScale
void setFontScale(float scale)
Sets the scale apply to parent's font size when font size is NaN.- Parameters:
scale- the scale
-
getEffectiveFont
java.awt.Font getEffectiveFont()
Returns the effective font of this component.- Returns:
- the effective font of this component
-
setFont
void setFont(java.awt.Font font)
Sets the font name, style and size for this component.- Parameters:
font- the desiredFontfor this component
-
getLocation
java.awt.geom.Point2D getLocation()
Returns the location of this component.- Returns:
- the base point in its parent's paper coordinate space
-
getSize
java.awt.geom.Dimension2D getSize()
Returns the paper size of this component.- Returns:
-
getBounds
java.awt.geom.Rectangle2D getBounds()
Returns the paper bounds relative to its location. The units of bounds is pt (1/72 inch)- Returns:
- the paper bounds of this component.
-
getSelectableBounds
java.awt.geom.Rectangle2D getSelectableBounds()
Returns the selectable bounds relative to its location. The selectable bound may be slightly larger than the bounds, for easy selection by mouse. The units of bounds is pt (1/72 inch)- Returns:
- the paper bounds of this component.
-
getPaperTransform
PaperTransform getPaperTransform()
Returns the paper transform of this component, which can be used to convert between device coordinate and paper coordinate of this component. The original point of paper coordinate is the location point of this component.Returns
nullif the component is not added to a plot or not laid out- Returns:
- the paper transform of this component
-
-
DMelt 3.0 © DataMelt by jWork.ORG