|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.javasoft.plaf.synthetica.painter.MenuPainter
public class MenuPainter
Painter for menu elements.
| Nested Class Summary | |
|---|---|
static class |
Cacheable.ScaleType
|
| Field Summary | |
|---|---|
protected static java.util.HashMap<java.lang.String,de.javasoft.plaf.synthetica.painter.SyntheticaComponentPainter> |
instances
|
static java.lang.String |
UI_KEY
|
| Constructor Summary | |
|---|---|
protected |
MenuPainter()
Constructor. |
| Method Summary | |
|---|---|
protected float |
calcRelativeArc(java.awt.Graphics2D g2,
float arc,
float offset)
Helper method to calculate an arc relative to the given offset. |
protected float |
calcRelativeGradientPos(java.awt.Graphics2D g2,
float pos,
float offset)
Helper method to calculate a relative gradient position in respect to the given offset. |
protected static float |
calcRelativeLength(java.awt.Graphics2D g2,
float length,
float offset)
Helper method to calculate a length in respect to the given offset. |
protected float |
calcRelativePos(java.awt.Graphics2D g2,
float pos,
float offset)
Helper method to calculate a relative position in respect to the given offset. |
protected java.awt.Color |
createAlphaColor(java.awt.Color color,
java.lang.Float alpha)
Helper method to create a alpha color from a solid color. |
protected java.awt.Paint |
createLinearGradientPaint(float startX,
float startY,
float endX,
float endY,
float[] fractions,
java.awt.Color[] colors)
Convenient method to create a LinearGradientPaint for Java 1.5 and Java 6. |
protected java.awt.BasicStroke |
createStroke(javax.swing.plaf.synth.SynthContext sc)
Creates the stroke used for Java2D painting. |
int |
getCacheHash(javax.swing.plaf.synth.SynthContext sc,
int w,
int h,
int meta,
java.lang.String id)
Returns a cache hash value which is used by SyntheticaSoftCache. |
java.awt.Insets |
getCacheScaleInsets(javax.swing.plaf.synth.SynthContext sc,
java.lang.String id)
Returns the insets in case of 9 square scaling is used. |
Cacheable.ScaleType |
getCacheScaleType(java.lang.String id)
Returns the scaling type which will be used for scaling. |
static MenuPainter |
getInstance()
Returns painter instance. |
static MenuPainter |
getInstance(javax.swing.plaf.synth.SynthContext sc)
Returns painter instance. |
protected static de.javasoft.plaf.synthetica.painter.SyntheticaComponentPainter |
getInstance(javax.swing.plaf.synth.SynthContext sc,
java.lang.Class<?> syntheticaPainter,
java.lang.String customPainterUIKey)
Returns a painter instance. |
protected static java.lang.String |
getPainterClassName(javax.swing.plaf.synth.SynthContext sc,
java.lang.Class<?> syntheticaPainter,
java.lang.String customPainterUIKey)
|
protected float |
getScale()
Returns the current scale factor. |
protected java.awt.Color |
getSyntheticaBackgroundColor(javax.swing.JComponent c)
Helper method to create the Synthetica background color with alpha value provided by component background property or client properties "Synthetica.background" and "Synthetica.background.alpha". |
void |
paintCheckBoxMenuItemBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintCheckBoxMenuItemBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintMenuBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
Paints menu background. |
void |
paintMenuBarBackground(javax.swing.JComponent c,
SyntheticaState state,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
Paint the menu bar background. |
void |
paintMenuBarBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintMenuBarBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintMenuBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintMenuItemBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
Paints menu item background. |
void |
paintMenuItemBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintPopupMenuBackground(javax.swing.JPopupMenu popup,
boolean toplevelPopup,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
Paints popup menu background. |
void |
paintPopupMenuBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
Paint popup menu background. |
void |
paintPopupMenuBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintRadioButtonMenuItemBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
void |
paintRadioButtonMenuItemBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
protected void |
paintToplevelPopupMenuMarker(javax.swing.JPopupMenu popup,
java.awt.Insets toplevelInsets,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
protected void |
paintToplevelPopupMenuTitleBackground(javax.swing.JComponent popup,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
|
protected java.awt.Graphics2D |
prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
boolean antiAlias)
Prepare graphics for Java2D painting. |
protected java.awt.Graphics2D |
prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
boolean antiAlias,
boolean translateXY)
Prepare graphics for Java2D painting. |
protected java.awt.Graphics2D |
prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
boolean antiAlias,
boolean translateXY,
java.awt.BasicStroke stroke)
Prepares/configures graphics object for 2D painting. |
protected java.awt.Graphics2D |
prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.awt.BasicStroke stroke)
Deprecated. |
protected java.awt.Graphics2D |
prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
boolean respectStrokeWidth)
Deprecated. |
static void |
reinitialize()
|
protected void |
restoreGraphics2D(java.awt.Graphics2D g2)
Restore the already prepared graphics object. |
protected float |
scaleArc(float arc)
Returns a scaled arc. |
protected static java.awt.Shape |
subtractStroke(java.awt.Graphics2D g2,
java.awt.Shape s)
Helper method to subtract the stroke from the given shape. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String UI_KEY
protected static java.util.HashMap<java.lang.String,de.javasoft.plaf.synthetica.painter.SyntheticaComponentPainter> instances
| Constructor Detail |
|---|
protected MenuPainter()
| Method Detail |
|---|
public static MenuPainter getInstance()
public static MenuPainter getInstance(javax.swing.plaf.synth.SynthContext sc)
public static void reinitialize()
public void paintMenuBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintMenuItemBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintPopupMenuBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintMenuBarBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintPopupMenuBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintPopupMenuBackground(javax.swing.JPopupMenu popup,
boolean toplevelPopup,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
protected void paintToplevelPopupMenuMarker(javax.swing.JPopupMenu popup,
java.awt.Insets toplevelInsets,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
protected void paintToplevelPopupMenuTitleBackground(javax.swing.JComponent popup,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintMenuBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintMenuItemBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintRadioButtonMenuItemBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintRadioButtonMenuItemBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintCheckBoxMenuItemBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintCheckBoxMenuItemBorder(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintMenuBarBackground(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
public void paintMenuBarBackground(javax.swing.JComponent c,
SyntheticaState state,
java.awt.Graphics g,
int x,
int y,
int w,
int h)
c - The relevant componentstate - Current component stateg - Graphics used for renderingx - The x positiony - The y positionw - The widthh - The height
protected static de.javasoft.plaf.synthetica.painter.SyntheticaComponentPainter getInstance(javax.swing.plaf.synth.SynthContext sc,
java.lang.Class<?> syntheticaPainter,
java.lang.String customPainterUIKey)
protected static java.lang.String getPainterClassName(javax.swing.plaf.synth.SynthContext sc,
java.lang.Class<?> syntheticaPainter,
java.lang.String customPainterUIKey)
protected java.awt.Graphics2D prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
boolean antiAlias,
boolean translateXY,
java.awt.BasicStroke stroke)
sc - Synth context, can be null.g - Graphics object.x - Original X-position, if translateXY is true the point of origin is X,Y which means the paint method doesn't have to
respect the X-position.y - Original Y-position, if translateXY is true the point of origin is X,Y which means the paint method doesn't have to
respect the Y-position.antiAlias - True means anti-alias rendering hint will be set - it's recommended to enable anti-aliasing for borders (#draw(Shape s))
and for background fills (#fill(Shape s)) in case that the border is translucent.translateXY - True, translate graphics to specified X,Y coordinates and respect stroke width - point of origin for painting is X,Y.stroke - Stroke used for painting - can be null in this case (createStroke(SynthContext) will be used).
protected java.awt.Graphics2D prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
boolean antiAlias)
prepareGraphics2D(SynthContext, Graphics, int, int, boolean, boolean, BasicStroke),
createStroke(SynthContext)
protected java.awt.Graphics2D prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
boolean antiAlias,
boolean translateXY)
prepareGraphics2D(SynthContext, Graphics, int, int, boolean, boolean, BasicStroke),
createStroke(SynthContext)
protected java.awt.Graphics2D prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.awt.BasicStroke stroke)
prepareGraphics2D(SynthContext, Graphics, int, int, boolean, boolean, BasicStroke)
protected java.awt.Graphics2D prepareGraphics2D(javax.swing.plaf.synth.SynthContext sc,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
boolean respectStrokeWidth)
prepareGraphics2D(SynthContext, Graphics, int, int, boolean, boolean, BasicStroke)protected void restoreGraphics2D(java.awt.Graphics2D g2)
protected float getScale()
protected java.awt.BasicStroke createStroke(javax.swing.plaf.synth.SynthContext sc)
protected float scaleArc(float arc)
arc - The unscaled arc.
protected float calcRelativeArc(java.awt.Graphics2D g2,
float arc,
float offset)
g2 - 2D graphics object.arc - The base arc.offset - The offset in pixel.
protected float calcRelativePos(java.awt.Graphics2D g2,
float pos,
float offset)
g2 - 2D graphics object.pos - X/Y-position.offset - The offset in pixel.
protected float calcRelativeGradientPos(java.awt.Graphics2D g2,
float pos,
float offset)
g2 - 2D graphics object.pos - X/Y-position.offset - The offset in pixel.
protected static float calcRelativeLength(java.awt.Graphics2D g2,
float length,
float offset)
g2 - 2D graphics object.length - The length.offset - The offset in pixel.
protected static java.awt.Shape subtractStroke(java.awt.Graphics2D g2,
java.awt.Shape s)
g2 - Graphics.s - The shape.
protected java.awt.Color getSyntheticaBackgroundColor(javax.swing.JComponent c)
c - The relevant JComponent.
protected java.awt.Color createAlphaColor(java.awt.Color color,
java.lang.Float alpha)
color - The color.alpha - The alpha value - null means 0.1f
protected java.awt.Paint createLinearGradientPaint(float startX,
float startY,
float endX,
float endY,
float[] fractions,
java.awt.Color[] colors)
SyntheticaLookAndFeel.createLinearGradientPaint(float, float, float, float, float[], Color[])
public int getCacheHash(javax.swing.plaf.synth.SynthContext sc,
int w,
int h,
int meta,
java.lang.String id)
sc - The synth contextw - The paint widthh - The paint heightmeta - A context related meta valueid - Usually the relevant painter method name
public Cacheable.ScaleType getCacheScaleType(java.lang.String id)
id - Usually the relevant painter method name
public java.awt.Insets getCacheScaleInsets(javax.swing.plaf.synth.SynthContext sc,
java.lang.String id)
sc - The synth contextid - Usually the relevant painter method name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||