public class SynthUtils extends Object
Modifier and Type | Field and Description |
---|---|
private static SynthPainter |
NULL_PAINTER
Used to avoid null painter checks everywhere.
|
Constructor and Description |
---|
SynthUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
getComponentState(JComponent c) |
static SynthContext |
getContext(JComponent c,
Region region,
SynthStyle style,
int state)
Returns a SynthContext with the specified values.
|
static SynthContext |
getContext(SynthContext context,
int state)
Returns a context with the given component state and all other fields same as input context.
|
static SynthContext |
getContext(SynthContext context,
SynthStyle style) |
static SynthPainter |
getPainter(SynthContext context)
Returns a SynthPainter from the context's style.
|
static boolean |
shouldUpdateStyle(PropertyChangeEvent event)
Returns true if the Style should be updated in response to the
specified PropertyChangeEvent.
|
static void |
update(SynthContext context,
Graphics g)
A convenience method that handles painting of the background.
|
static void |
update(SynthContext context,
Graphics g,
Rectangle bounds)
A convenience method that handles painting of the background.
|
private static SynthPainter NULL_PAINTER
public SynthUtils()
public static SynthContext getContext(JComponent c, Region region, SynthStyle style, int state)
component
- JComponentregion
- Identifies the portion of the JComponentstyle
- Style associated with the componentstate
- State of the component as defined in SynthConstants.NullPointerException
- if component, region of style is null.public static SynthContext getContext(SynthContext context, SynthStyle style)
context
- style
- public static SynthContext getContext(SynthContext context, int state)
context
- the context, must not be nullstate
- the component state.public static SynthPainter getPainter(SynthContext context)
context
- SynthContext containing the style, must not be null.public static boolean shouldUpdateStyle(PropertyChangeEvent event)
shouldUpdateStyleOnAncestorChanged
as necessary.public static int getComponentState(JComponent c)
public static void update(SynthContext context, Graphics g)
context
- must not be nullg
- must not be nullpublic static void update(SynthContext context, Graphics g, Rectangle bounds)
context
- must not be nullg
- must not be nullthe
- bounds to fill, may be null to indicate the complete sizeWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses