|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsears.search.gui.PillShape
public class PillShape
A PillShape is a rounded bordered rectangle with text inside.
Field Summary | |
---|---|
protected static java.awt.Composite |
ALPHA_COMPOSITE
|
protected static float |
BORDER_STROKE
stroke use for line limit |
protected static float |
DECAY
|
protected static int |
EXPANDED
|
protected static int |
EXPANDED_HEIGHT
expanded height factor |
protected static int |
EXPANDED_WIDTH
expanded width factor |
protected static java.awt.Color |
PILL_BACKGROUND_COLOR
pill background color |
protected static java.awt.Color |
PILL_FOREGROUND_COLOR
pill foreground color |
protected static int |
ROUNDED_ARC
arc factor, use or the rounded rectangle |
protected static java.awt.Stroke |
STROKE
|
Constructor Summary | |
---|---|
PillShape(java.awt.Font font,
java.awt.Rectangle bounds,
java.lang.String text)
Creates a new instance of PillShape by passing ... |
Method Summary | |
---|---|
protected java.lang.Object |
clone()
Calls the super method and catch the clone exception if occurs. |
java.awt.Color |
getBackground()
Gets the background color |
java.awt.Shape |
getBounds()
Returns a RoundRectangle2D object, represents the real bounds of this shape |
protected PillShape |
getClone()
Gets a clone of the PillShape object |
java.awt.Color |
getForeground()
Gets the foreground color |
PillShape |
getPillInstance(java.awt.Font newFont,
java.awt.Rectangle newBounds,
java.lang.String newText,
java.awt.Point newLocation)
Gets an instance of the object with a new data set Optimization... |
void |
paint(java.awt.Graphics2D gr)
Paint the GPShape using the graphics context given in parameters |
void |
setBackground(java.awt.Color background)
Sets the background color for the pill |
void |
setForeground(java.awt.Color foreground)
Sets the foreground color for the pill Foreground color is used for the text inside and pill's border |
void |
translate(int x,
int y)
Translates the GPShape object to the new given coordinates. |
void |
translate(java.awt.Point point)
Translates the GPShape object to the new given point location. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int EXPANDED
protected static final int EXPANDED_HEIGHT
protected static final int EXPANDED_WIDTH
protected static final float DECAY
protected static final int ROUNDED_ARC
protected static final float BORDER_STROKE
protected static final java.awt.Color PILL_FOREGROUND_COLOR
protected static final java.awt.Color PILL_BACKGROUND_COLOR
protected static final java.awt.Stroke STROKE
protected static final java.awt.Composite ALPHA_COMPOSITE
Constructor Detail |
---|
public PillShape(java.awt.Font font, java.awt.Rectangle bounds, java.lang.String text)
PillShape
by passing ...
WARNING:
This class is a beta class, so there's some limitation:
The parameter bounds
must be the bounds of the text
string
There's no control of any sort about this coherence, so use at your own risk.
font
- the fontbounds
- the text boundstext
- the text
java.lang.NullPointerException
- if at least one of the given parameters is nullMethod Detail |
---|
public void setBackground(java.awt.Color background)
background
- the background color, if null the default background color will be usedpublic void setForeground(java.awt.Color foreground)
foreground
- the foreground color, if null the default foreground color will be usedpublic java.awt.Color getForeground()
public java.awt.Color getBackground()
public java.awt.Shape getBounds()
RoundRectangle2D
object, represents the real bounds of this shape
getBounds
in interface GPShape
GPShape.getBounds()
public void paint(java.awt.Graphics2D gr)
GPShape
GPShape
using the graphics context given in parameters
paint
in interface GPShape
gr
- the graphics contextpublic void translate(int x, int y)
GPShape
GPShape
object to the new given coordinates.
translate
in interface GPShape
x
- the new x coordinates.y
- the new y coordinates.public void translate(java.awt.Point point)
GPShape
GPShape
object to the new given point location.
translate
in interface GPShape
point
- the new point locationprotected java.lang.Object clone()
clone
in class java.lang.Object
Object
or null if the super method failed to clone the objectObject.clone()
protected PillShape getClone()
PillShape
object
PillShape
object or null if clone() method failedpublic PillShape getPillInstance(java.awt.Font newFont, java.awt.Rectangle newBounds, java.lang.String newText, java.awt.Point newLocation)
newFont
- the font to associate to the pillnewBounds
- the text boundsnewText
- the textnewLocation
- the pill location
Pill
object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |