public class TLcdG2DLineStyle extends Object implements ILcdGXYPainterStyle, ILcdCloneable
ILcdGXYPainterStyle
that represents a line style, with a color
and line width that can be different in regular and selected mode.
This implementation requires Graphics2D
instances.
Constructor and Description |
---|
TLcdG2DLineStyle()
Creates a default line style.
|
TLcdG2DLineStyle(Color aColor,
Color aSelectionColor)
Creates a new line style with a width of 1 pixel, based on the given colors.
|
TLcdG2DLineStyle(Color aColor,
double aWidth,
Color aSelectionColor,
double aSelectionWidth)
Creates a new line style based on the given colors and widths.
|
TLcdG2DLineStyle(TLcdG2DLineStyle aLineStyle)
Creates a new line style based on the given style.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Makes
Object.clone() public. |
Color |
getColor()
Returns the color used in default mode.
|
double |
getLineWidth()
Returns the line width used in default mode.
|
Color |
getSelectionColor()
Returns the color used in selection mode.
|
double |
getSelectionLineWidth()
Returns the line width used in selection mode.
|
boolean |
isAntiAliasing()
Returns whether to use anti-aliasing when painting.
|
void |
setAntiAliasing(boolean aAntiAliasing)
Sets whether to use anti-aliasing when painting.
|
void |
setColor(Color aColor)
Sets the color used in default mode.
|
void |
setLineWidth(double aLineWidth)
Sets the line width used in default mode.
|
void |
setSelectionColor(Color aSelectionColor)
Sets the color used in selection mode.
|
void |
setSelectionLineWidth(double aSelectionLineWidth)
Sets the line width used in selection mode.
|
void |
setupGraphics(Graphics aGraphics,
Object aObject,
int aMode,
ILcdGXYContext aGXYContext)
Configures
aGraphics for painting the given object. |
public TLcdG2DLineStyle()
public TLcdG2DLineStyle(Color aColor, Color aSelectionColor)
aColor
- the line color used in default modeaSelectionColor
- the line color used in selection modepublic TLcdG2DLineStyle(Color aColor, double aWidth, Color aSelectionColor, double aSelectionWidth)
aColor
- the line color used in default modeaWidth
- the line width used in default modeaSelectionColor
- the line color used in selection modeaSelectionWidth
- the line width used in selection modepublic TLcdG2DLineStyle(TLcdG2DLineStyle aLineStyle)
aLineStyle
- a style whose settings will be copiedpublic Color getColor()
setColor(java.awt.Color)
public void setColor(Color aColor)
aColor
- the new color to be used in default mode.getColor()
public Color getSelectionColor()
setSelectionColor(java.awt.Color)
public void setSelectionColor(Color aSelectionColor)
aSelectionColor
- the new color to be used in selection mode.getSelectionColor()
public double getLineWidth()
setLineWidth(double)
public void setLineWidth(double aLineWidth)
aLineWidth
- the new line width to be used in default modegetLineWidth()
public double getSelectionLineWidth()
setSelectionLineWidth(double)
public void setSelectionLineWidth(double aSelectionLineWidth)
aSelectionLineWidth
- the new line width to be used in selection modegetSelectionLineWidth()
public boolean isAntiAliasing()
setAntiAliasing(boolean)
public void setAntiAliasing(boolean aAntiAliasing)
See also ILcdGXYView.isAntiAliased()
.
aAntiAliasing
- if true, uses anti-aliasing when paintingisAntiAliasing()
public void setupGraphics(Graphics aGraphics, Object aObject, int aMode, ILcdGXYContext aGXYContext)
aGraphics
for painting the given object.
In particular, the stroke will be changed to have the configured line width, color and aliasing,
depending on the selection mode.setupGraphics
in interface ILcdGXYPainterStyle
aGraphics
- the Graphics
to set up. This implementation relies on a Graphics2D
instance.aObject
- the Object
to paint.aMode
- the painting mode to consider (defined in
ILcdGXYPainter
).aGXYContext
- the ILcdGXYContext
to consider.ILcdGXYPainter
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()