Class RectanglePainter
java.lang.Object
org.jdesktop.beans.AbstractBean
org.jdesktop.swingx.painter.AbstractPainter<Object>
org.jdesktop.swingx.painter.AbstractLayoutPainter<Object>
org.jdesktop.swingx.painter.AbstractAreaPainter<Object>
org.jdesktop.swingx.painter.RectanglePainter
A painter which paints square and rounded rectangles
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractAreaPainter
AbstractAreaPainter.StyleNested classes/interfaces inherited from class AbstractLayoutPainter
AbstractLayoutPainter.HorizontalAlignment, AbstractLayoutPainter.VerticalAlignmentNested classes/interfaces inherited from class AbstractPainter
AbstractPainter.Interpolation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate booleanprivate intprivate intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of RectanglePainterRectanglePainter(int top, int left, int bottom, int right) RectanglePainter(int top, int left, int bottom, int right, int roundWidth, int roundHeight) RectanglePainter(int top, int left, int bottom, int right, int roundWidth, int roundHeight, boolean rounded, Paint fillPaint, float strokeWidth, Paint borderPaint) RectanglePainter(int width, int height, int cornerRadius, Paint fillPaint) RectanglePainter(Color fillPaint, Color borderPaint) RectanglePainter(Insets insets, int width, int height, int roundWidth, int roundHeight, boolean rounded, Paint fillPaint, float strokeWidth, Paint borderPaint) RectanglePainter(Paint fillPaint, Paint borderPaint, float borderWidth, AbstractAreaPainter.Style style) -
Method Summary
Modifier and TypeMethodDescriptionprotected RectangularShapecalculateShape(int width, int height) protected voiddoPaint(Graphics2D g, Object component, int width, int height) Subclasses must implement this method and perform custom painting operations here.private voiddrawBackground(Graphics2D g, Shape shape, int width, int height) private voiddrawBorder(Graphics2D g, Shape shape, int width, int height) intgets the round height of the rectangleintgets the round width of the rectanglebooleanIndicates if the rectangle is roundedprotected ShapeprovideShape(Graphics2D g, Object comp, int width, int height) Returns the outline shape of this painter.voidsetRounded(boolean rounded) sets if the rectangle should be roundedvoidsetRoundHeight(int roundHeight) sets the round height of the rectanglevoidsetRoundWidth(int roundWidth) sets the round width of the rectangleMethods inherited from class AbstractAreaPainter
calculateSnappedPaint, getAreaEffects, getBorderPaint, getBorderWidth, getFillPaint, getStyle, isPaintStretched, setAreaEffects, setBorderPaint, setBorderWidth, setFillPaint, setPaintStretched, setStyleMethods inherited from class AbstractLayoutPainter
calculateLayout, getHorizontalAlignment, getInsets, getVerticalAlignment, isFillHorizontal, isFillVertical, setFillHorizontal, setFillVertical, setHorizontalAlignment, setInsets, setVerticalAlignmentMethods inherited from class AbstractPainter
clearCache, configureGraphics, getFilters, getInterpolation, isAntialiasing, isCacheable, isCacheCleared, isDirty, isInPaintContext, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInPaintContext, setInterpolation, setVisible, shouldUseCache, validateMethods inherited from class AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
rounded
private boolean rounded -
roundWidth
private int roundWidth -
roundHeight
private int roundHeight -
width
private int width -
height
private int height
-
-
Constructor Details
-
RectanglePainter
public RectanglePainter()Creates a new instance of RectanglePainter -
RectanglePainter
public RectanglePainter(int top, int left, int bottom, int right) -
RectanglePainter
public RectanglePainter(int top, int left, int bottom, int right, int roundWidth, int roundHeight) -
RectanglePainter
-
RectanglePainter
-
RectanglePainter
public RectanglePainter(Paint fillPaint, Paint borderPaint, float borderWidth, AbstractAreaPainter.Style style) -
RectanglePainter
-
RectanglePainter
-
-
Method Details
-
isRounded
public boolean isRounded()Indicates if the rectangle is rounded- Returns:
- if the rectangle is rounded
-
setRounded
public void setRounded(boolean rounded) sets if the rectangle should be rounded- Parameters:
rounded- if the rectangle should be rounded
-
getRoundWidth
public int getRoundWidth()gets the round width of the rectangle- Returns:
- the current round width
-
setRoundWidth
public void setRoundWidth(int roundWidth) sets the round width of the rectangle- Parameters:
roundWidth- a new round width
-
getRoundHeight
public int getRoundHeight()gets the round height of the rectangle- Returns:
- the current round height
-
setRoundHeight
public void setRoundHeight(int roundHeight) sets the round height of the rectangle- Parameters:
roundHeight- a new round height
-
calculateShape
-
doPaint
Description copied from class:AbstractPainterSubclasses must implement this method and perform custom painting operations here.- Specified by:
doPaintin classAbstractPainter<Object>- Parameters:
g- The Graphics2D object in which to paintcomponent-width-height-
-
drawBorder
-
drawBackground
-
provideShape
Description copied from class:AbstractAreaPainterReturns the outline shape of this painter. Subclasses must implement this method. This shape will be used for filling, stroking, and clipping.- Specified by:
provideShapein classAbstractAreaPainter<Object>- Parameters:
g- graphicscomp- The Object this painter will be painted on.width- the width to paintheight- the height to paint- Returns:
- the outline shape of this painter
-