Class Style


  extended by Object
      extended by Style

public class Style
extends Object

This class represents the look and feel of Component.

For more detailed documentation see stylesheet.

Style affects following:

Images, fonts, colors and arguments are used for specific customization on certain components. For instance, custom Canvas component can utilize them.

See Also:
Canvas, Component, Component.setStyle(Style), Component.getStyle(), getStyle(String)

Method Summary
 int argument(int i)
          Return custom argument.
 int color(int i)
          Return custom color.
 int consumed(int dirs)
          Calculates the total amount of space consumed from specified edges of this style.
 Style focused()
          Returns the focused variant of this style.
 Font font(int i)
          Return custom font.
 Image image(int i)
          Return custom image.
 void setPainter(PaintCallback callback)
          Sets a paint callback for this style.
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

color

public int color(int i)
Return custom color.

Parameters:
i - index between [0..3]

argument

public int argument(int i)
Return custom argument.

Parameters:
i - index between [0..3]

font

public Font font(int i)
Return custom font.

Parameters:
i - index between [0..3]

image

public Image image(int i)
Return custom image.

Parameters:
i - index between [0..3]

consumed

public int consumed(int dirs)
Calculates the total amount of space consumed from specified edges of this style.

Parameters:
dirs - Combination of TOP, BOTTOM LEFT and RIGHT.
Returns:
Amount of space consumed, in pixels.

focused

public Style focused()
Returns the focused variant of this style.

Returns:
Focused variant of this style, or null if there is no focused variant
Since:
2.0.0

setPainter

public void setPainter(PaintCallback callback)
Sets a paint callback for this style. Callback is responsible for painting both the border and background area of widget. Once this method is called this style will no longer use the original border and background formats.

Parameters:
callback - Paint callback, received arguments are:
  • Component being painted
  • Graphics to draw into
  • This style
  • Width of border and background area
  • Height of border and background area
Since:
2.0.0