|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The DrawableKey
interface is a drawable key, that must implement the
method drawKey, fillKey
, and settings methods.
The drawing method must be one of the two calls. If the parameters include simply a Graphics2D, then the drawing method redraws the key as previously drawn (using drawKey or fillKey) in the Graphics2D passed to it. If the parameters are a Graphics2D and an AffineTransform, then the drawing method draws using the AffineTransform, starting from (0,0) and assuming the removal of any current AffineTransforms. This indicates, that a scaling of 10 will result in a size of 10 and a transpose of (5,10) results in the drawing at (5,10) and so forth.
The fillKey
fills the Graphics2D passed to it with the key. The method also sets
the transform so a call to drawKey
without a transform will drawn exactly as drawn
in fillKey.
The settings methods, setSettings
and getSettings
, refer to KetSettings
generally used to render the key.
All of the methods must be present in a DrawableKey. However not all must act. If the
DrawableKey has no need for KeySettings
than the setting methods can be left
empty.
DrawingKey
Method Summary | |
java.lang.Object |
clone()
Makes public the protected clone method in Object. |
void |
drawKey(java.awt.Graphics2D g2)
Draws the actual key, first setting all values for the Graphics2D g2. |
void |
drawKey(java.awt.Graphics2D g2,
java.awt.geom.AffineTransform a)
Draws the key in the given Graphics2D, using the AffineTransform passed to it. |
void |
fillKey(java.awt.Graphics2D g2)
Draws the key filling the given Graphics2D. |
KeySettings |
getSettings()
Gets the KeySettings of the key. |
boolean |
isSettingsSaved()
Returns true if the KeySettings are currently saved. |
void |
restoreSettings()
Restores the settings for the key. |
void |
saveSettings()
Saves the settings for the key. |
void |
setKeySettings(KeySettings s)
Sets the KeySettings of the DrawableKey . |
void |
setSettings(KeySettings k)
Sets the KeySettings of the DrawableKey . |
Method Detail |
public void drawKey(java.awt.Graphics2D g2)
drawKey
or
fillKey
.
g2
- g2 Graphics2D that the key is painted to.public void drawKey(java.awt.Graphics2D g2, java.awt.geom.AffineTransform a)
g2
- g2 Graphics2D that this fills with the key.a
- AffineTransform
that transforms the key, using no previous transforms.public void fillKey(java.awt.Graphics2D g2)
g2
- Graphics2D that fills with the key.public java.lang.Object clone()
clone
in class java.lang.Object
public void setSettings(KeySettings k)
KeySettings
of the DrawableKey
.
These settings are used for drawing the key in a given Graphics2D.
Can be left empty
k
- KeySettings
for use in drawing the key.public void setKeySettings(KeySettings s)
KeySettings
of the DrawableKey
.
These settings are used for drawing the key in a given Graphics2D.
s
- KeySettings
for use in drawing the key.public KeySettings getSettings()
KeySettings
of the key.
Can be left empty
KeySettings
for use in drawing the key.public void saveSettings()
public void restoreSettings()
public boolean isSettingsSaved()
KeySettings
are currently saved.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |