|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j4me.ui.Theme
public class Theme
Derive this class to set the application's theme. A theme controls the color scheme and background graphics used to skin the application.
Themes do not alter the shapes or functionality of components. To change the behavior of appearance of any component it is up to you to derive a new component type and implement the changes.
Field Summary | |
---|---|
static int |
BLACK
Black |
static int |
BLUE
Blue |
static int |
BLUE_GREEN
Blue-green |
static int |
BROWN
Brown |
static int |
BURNT_ORANGE
Burnt orange |
static int |
CYAN
Cyan |
static int |
DARK_GREEN
Dark green |
static int |
FOREST_GREEN
Forest green |
static int |
GRAY
Gray |
static int |
GREEN
Green |
static int |
LAVENDAR
Lavendar |
static int |
LIGHT_BLUE
Light blue |
static int |
LIGHT_GRAY
Light gray |
static int |
LIGHT_GREEN
Light green |
static int |
LIGHT_RED
Light red |
static int |
MAGENTA
Magenta |
static int |
MAROON
Maroon |
static int |
MEDIUM_GREEN
Medium green |
static int |
NAVY
Navy blue |
static int |
NEON_BLUE
Neon blue |
static int |
ORANGE
Orange |
static int |
RED
Red |
static int |
SILVER
Silver |
static int |
WHITE
White |
static int |
YELLOW
Yellow |
Constructor Summary | |
---|---|
Theme()
Creates a Theme object. |
Method Summary | |
---|---|
int |
getBackgroundColor()
Returns the color used as the background for the canvas section of the screen. |
int |
getBorderColor()
Returns the color used for borders in the canvas section of the UI. |
javax.microedition.lcdui.Font |
getFont()
Gets the basic default font. |
int |
getFontColor()
The color of the text written with the font returned by getFont . |
int |
getHighlightColor()
Returns the main color used in painting components. |
int |
getMenuBarBackgroundColor()
Returns the primary color of the background of the menu bar. |
int |
getMenuBarBorderColor()
Returns the color of the border around the menu bar. |
int |
getMenuBarHighlightColor()
Returns the highlight color applied as a vertical gradient to the menu bar. |
javax.microedition.lcdui.Font |
getMenuFont()
Returns the font used in the menu bar at the bottom of the canvas. |
int |
getMenuFontColor()
The color of the text written with the font returned by getMenuFont . |
int |
getMenuFontHighlightColor()
The color of the menu text when the menu button is pressed. |
int |
getMenuHeight()
Gets the height of the menu bar in pixels. |
java.lang.String |
getMenuTextForCancel()
Gets the localized menu text for Cancel buttons that appear on forms. |
java.lang.String |
getMenuTextForOK()
Gets the localized menu text for OK buttons that appear on forms. |
int |
getScrollbarBackgroundColor()
Returns the color of the background of the scrollbar. |
int |
getScrollbarBorderColor()
Returns the color of the border around the scrollbar. |
int |
getScrollbarHighlightColor()
Returns the highlight color applied as a horizontal gradient to the scrollbar. |
int |
getScrollbarTrackbarColor()
Returns the color of the trackbar within the scrollbar. |
int |
getTitleBarBackgroundColor()
Returns the primary color of the background of the title bar. |
int |
getTitleBarBorderColor()
Returns the color of the border around the title bar. |
int |
getTitleBarHighlightColor()
Returns the highlight color applied as a vertical gradient to the title bar. |
javax.microedition.lcdui.Font |
getTitleFont()
Returns the font used for writing the title in the screen's title area. |
int |
getTitleFontColor()
The color of the text written with the font returned by getTitleFont . |
int |
getTitleHeight()
Gets the height of the title bar in pixels. |
int |
getVerticalScrollbarWidth()
Returns the width of the vertical scrollbar. |
static void |
gradientFill(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height,
boolean fillVertically,
int primaryColor,
int secondaryColor,
double maxSecondary)
Fills a rectangle with linear gradient. |
void |
paintBackground(javax.microedition.lcdui.Graphics g)
Paints the background of the main section of the screen. |
void |
paintMenuBar(javax.microedition.lcdui.Graphics g,
java.lang.String left,
boolean highlightLeft,
java.lang.String right,
boolean highlightRight,
int width,
int height)
Paints the menu bar at the bottom of the canvas. |
protected void |
paintMenuBarBackground(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height)
Paints the background area of the menu bar. |
protected void |
paintScrollbarBackground(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height)
Paints the background area of the scrollbar. |
void |
paintTitleBar(javax.microedition.lcdui.Graphics g,
java.lang.String title,
int width,
int height)
Paints the title bar of the canvas. |
protected void |
paintTitleBarBackground(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height)
Paints the background area of the title bar. |
protected void |
paintTrackbar(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height)
Paints the trackbar on the scrollbar. |
void |
paintVerticalScrollbar(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height,
int offset,
int formHeight)
Paints the vertical scrollbar. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BLACK
public static final int BROWN
public static final int BLUE
public static final int NAVY
public static final int NEON_BLUE
public static final int LIGHT_BLUE
public static final int RED
public static final int MAROON
public static final int LIGHT_RED
public static final int MAGENTA
public static final int ORANGE
public static final int BURNT_ORANGE
public static final int YELLOW
public static final int GREEN
public static final int MEDIUM_GREEN
public static final int LIGHT_GREEN
public static final int DARK_GREEN
public static final int FOREST_GREEN
public static final int BLUE_GREEN
public static final int CYAN
public static final int SILVER
public static final int GRAY
public static final int LIGHT_GRAY
public static final int LAVENDAR
public static final int WHITE
Constructor Detail |
---|
public Theme()
Theme
object. After creating the theme it must
be attached to the UI manager to use it through the setTheme
method.
Method Detail |
---|
public javax.microedition.lcdui.Font getFont()
getFontColor()
public javax.microedition.lcdui.Font getMenuFont()
By default this font is the system font. Override this font to change the style of the title text.
getMenuFontColor()
,
paintMenuBar(Graphics, String, boolean, String, boolean, int, int)
public javax.microedition.lcdui.Font getTitleFont()
By default this font is the system font in bold. Override this font to change the style of the title text.
getTitleFontColor()
,
paintTrackbar(Graphics, int, int, int, int)
public int getFontColor()
getFont
.
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change the text color.
getFont
.getFontColor()
public int getMenuFontColor()
getMenuFont
.
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change the text color.
getMenuFont
.getMenuFont()
,
paintMenuBar(Graphics, String, boolean, String, boolean, int, int)
public int getMenuFontHighlightColor()
getMenuFontColor
.
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change the text color.
getMenuFont()
,
getMenuFontColor()
,
paintMenuBar(Graphics, String, boolean, String, boolean, int, int)
public int getTitleFontColor()
getTitleFont
.
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change the text color.
getTitleFont
.getTitleFont()
,
paintTrackbar(Graphics, int, int, int, int)
public int getBorderColor()
Override this method to change it.
public int getBackgroundColor()
Override this method to change it.
public int getHighlightColor()
Override this method to change it.
public int getTitleBarBorderColor()
By default this is the same color as the menu border. Override this method to change it.
paintTrackbar(Graphics, int, int, int, int)
public int getTitleBarBackgroundColor()
getTitleBarHighlightColor
is overlaid with
a vertical gradient.
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
By default this is the same color as the menu bar background. Override this method to change it.
getTitleBarHighlightColor()
public int getTitleBarHighlightColor()
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
By default this is the same color as the menu bar highlight. Override this method to change it.
getTitleBarBackgroundColor()
public int getMenuBarBorderColor()
Override this method to change it.
paintMenuBar(Graphics, String, boolean, String, boolean, int, int)
public int getMenuBarBackgroundColor()
getMenuBarHighlightColor
is overlaid with
a vertical gradient.
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change it.
getMenuBarHighlightColor()
public int getMenuBarHighlightColor()
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change it.
getMenuBarBackgroundColor()
public int getTitleHeight()
paintTrackbar(Graphics, int, int, int, int)
public void paintTitleBar(javax.microedition.lcdui.Graphics g, java.lang.String title, int width, int height)
setTitle
and the canvas
is not in full screen mode.
The supplied Graphics
will be set with an appropriate clip
and translated such that (0,0) is the top-left corner of the title
bar.
Override this method to change the appearance of the title bar. For example background or logo images can be placed throughout the application by painting them here.
g
- is the Graphics
object to paint with.title
- is the text for the title bar as defined by the
canvas class.width
- is the width of the title bar in pixels.height
- is the height of the title bar in pixels.protected void paintTitleBarBackground(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height)
paintTitleBar
method.
g
- is the Graphics
object to paint with.x
- is the top-left X-coordinate pixel of the title bar.y
- is the top-left Y-coordinate pixel of the title bar.width
- is the width of the title bar in pixels.height
- is the height of the title bar in pixels.paintTrackbar(Graphics, int, int, int, int)
public int getMenuHeight()
paintMenuBar(Graphics, String, boolean, String, boolean, int, int)
public void paintMenuBar(javax.microedition.lcdui.Graphics g, java.lang.String left, boolean highlightLeft, java.lang.String right, boolean highlightRight, int width, int height)
The supplied Graphics
will be set with an appropriate clip
and translated such that (0,0) is the top-left corner of the title
bar.
Override this method to change the appearance or functionality of the menu. Be careful not to write strings that are too long and will not fit on the menu bar.
g
- is the Graphics
object to paint with.left
- is the text to write on the left side of the menu bar.
The left side is associated with dimissing input such as a
"Cancel" button.highlightLeft
- is true
if the menu text left
should be highlighted to indicate the left menu button is currently
pressed.right
- is the text to write on the right side of the menu bar.
The right side is associated with accepting input such as an
"OK" button.highlightRight
- is true
if the menu text right
should be highlighted to indicate the right menu button is currently
pressed.width
- is the width of the menu bar in pixels.height
- is the height of the menu bar in pixels.protected void paintMenuBarBackground(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height)
paintMenuBar
method.
g
- is the Graphics
object to paint with.x
- is the top-left X-coordinate pixel of the menu bar.y
- is the top-left Y-coordinate pixel of the menu bar.width
- is the width of the menu bar in pixels.height
- is the height of the menu bar in pixels.paintMenuBar(Graphics, String, boolean, String, boolean, int, int)
public java.lang.String getMenuTextForOK()
public java.lang.String getMenuTextForCancel()
public void paintBackground(javax.microedition.lcdui.Graphics g)
After this method is called, the screen's paintCanvas
method will be.
By default this method paints the entire background the color specified
by getBackgroundColor
. Override this implementation to provide
a different background for the entire application, such as an image.
g
- is the Graphics
object to paint with.public void paintVerticalScrollbar(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height, int offset, int formHeight)
g
- is the Graphics
object to paint with.x
- is the top-left X-coordinate pixel of the form area.y
- is the top-left Y-coordinate pixel of the form area.width
- is the width of the form area in pixels.height
- is the height of the form area in pixels.offset
- is the vertical scrolling position of the top pixel
to show on the form area.formHeight
- is the total height of all the components on the
form. This is bigger than height
.protected void paintScrollbarBackground(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height)
paintScrollbarTrackbar
).
g
- is the Graphics
object to paint with.x
- is the top-left X-coordinate pixel of the scrollbar.y
- is the top-left Y-coordinate pixel of the scrollbar.width
- is the width of the scrollbar in pixels.height
- is the height of the scrollbar in pixels.paintVerticalScrollbar(Graphics, int, int, int, int, int, int)
,
paintTrackbar(Graphics, int, int, int, int)
protected void paintTrackbar(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height)
g
- is the Graphics
object to paint with.x
- is the top-left X-coordinate pixel of the trackbar.y
- is the top-left Y-coordinate pixel of the trackbar.width
- is the width of the trackbar in pixels.height
- is the height of the trackbar in pixels.paintVerticalScrollbar(Graphics, int, int, int, int, int, int)
,
paintScrollbarBackground(Graphics, int, int, int, int)
public int getVerticalScrollbarWidth()
public int getScrollbarBorderColor()
By default this is the same as the border color. Override this method to change it.
paintVerticalScrollbar(Graphics, int, int, int, int, int, int)
public int getScrollbarBackgroundColor()
By default this is the same as the scrollbar's border color. Override this method to change it.
paintVerticalScrollbar(Graphics, int, int, int, int, int, int)
public int getScrollbarHighlightColor()
Colors are defined as 0xAARRGGBB; the first-byte alpha-channel is ignored.
Override this method to change it.
getScrollbarBackgroundColor()
public int getScrollbarTrackbarColor()
By default this is the same as the menu bar's background color. Override this method to change it.
paintVerticalScrollbar(Graphics, int, int, int, int, int, int)
public static void gradientFill(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height, boolean fillVertically, int primaryColor, int secondaryColor, double maxSecondary)
primaryColor
to secondaryColor
at
maxSecondary
. So if maxSecondary == 0.70
then a line
across the fill rectangle 70% of the way would be
secondaryColor
.
g
- is the Graphics
object for painting.x
- is the left edge of the rectangle.y
- is the top edge of the rectangle.width
- is the width of the rectangle.height
- is the height of the rectangle.fillVertically
- is true
if the gradient goes from
top-to-bottom or false
for left-to-right.primaryColor
- is the main color.secondaryColor
- is the highlight color.maxSecondary
- is between 0.00 and 1.00 and says how far down
the fill will secondaryColor
peak.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |