Package org.jdesktop.swingx.painter
Class CapsulePainter
- java.lang.Object
-
- org.jdesktop.beans.AbstractBean
-
- org.jdesktop.swingx.painter.AbstractPainter<T>
-
- org.jdesktop.swingx.painter.AbstractLayoutPainter<T>
-
- org.jdesktop.swingx.painter.AbstractAreaPainter<Object>
-
- org.jdesktop.swingx.painter.CapsulePainter
-
public class CapsulePainter extends AbstractAreaPainter<Object>
Draws a capsule. This is a rectangle capped by two semi circles. You can draw only a portion of a capsule using the portion property.- Author:
- joshy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CapsulePainter.Portion
-
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractAreaPainter
AbstractAreaPainter.Style
-
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractLayoutPainter
AbstractLayoutPainter.HorizontalAlignment, AbstractLayoutPainter.VerticalAlignment
-
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractPainter
AbstractPainter.Interpolation
-
-
Constructor Summary
Constructors Constructor Description CapsulePainter()
Create a new CapsulePainter that draws a full capsule.CapsulePainter(CapsulePainter.Portion portion)
Create a new CapsulePainter that only draws the portion specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doPaint(Graphics2D g, Object component, int width, int height)
Subclasses must implement this method and perform custom painting operations here.CapsulePainter.Portion
getPortion()
Returns the current portion property.protected Shape
provideShape(Graphics2D g, Object comp, int width, int height)
Returns the outline shape of this painter.void
setPortion(CapsulePainter.Portion portion)
Sets the current portion property.-
Methods inherited from class org.jdesktop.swingx.painter.AbstractAreaPainter
getAreaEffects, getBorderPaint, getBorderWidth, getFillPaint, getStyle, isPaintStretched, setAreaEffects, setBorderPaint, setBorderWidth, setFillPaint, setPaintStretched, setStyle
-
Methods inherited from class org.jdesktop.swingx.painter.AbstractLayoutPainter
calculateLayout, getHorizontalAlignment, getInsets, getVerticalAlignment, isFillHorizontal, isFillVertical, setFillHorizontal, setFillVertical, setHorizontalAlignment, setInsets, setVerticalAlignment
-
Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter
clearCache, configureGraphics, getFilters, getInterpolation, isAntialiasing, isCacheable, isDirty, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInterpolation, setVisible, shouldUseCache, validate
-
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Constructor Detail
-
CapsulePainter
public CapsulePainter()
Create a new CapsulePainter that draws a full capsule.
-
CapsulePainter
public CapsulePainter(CapsulePainter.Portion portion)
Create a new CapsulePainter that only draws the portion specified.- Parameters:
portion
- the portion to draw
-
-
Method Detail
-
getPortion
public CapsulePainter.Portion getPortion()
Returns the current portion property. This property determines which part of the capsule will be drawn.- Returns:
- the current portion
-
setPortion
public void setPortion(CapsulePainter.Portion portion)
Sets the current portion property. This property determines which part of the capsule will be drawn.- Parameters:
portion
- the new portion
-
doPaint
protected void doPaint(Graphics2D g, Object component, int width, int height)
Subclasses must implement this method and perform custom painting operations here.- Specified by:
doPaint
in classAbstractPainter<Object>
- Parameters:
g
- The Graphics2D object in which to paint
-
provideShape
protected Shape provideShape(Graphics2D g, Object comp, int width, int height)
Returns the outline shape of this painter. Subclasses must implement this method. This shape will be used for filling, stroking, and clipping.- Specified by:
provideShape
in 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
-
-