de.enough.polish.ui.backgrounds
Class CombinedBackground

java.lang.Object
  extended by de.enough.polish.ui.Background
      extended by de.enough.polish.ui.backgrounds.CombinedBackground
All Implemented Interfaces:
Serializable

public class CombinedBackground
extends Background

Provides a background consisting of two other backgrounds.

You can combine more by two backgrounds by using nested further combined backgrounds.

Usage:

backgrounds {
        titleTop {
                type: polygon;
                points: 10,50 50,10 90,50 50,90;
                color: #d0f;
                scale-mode: proportional;
                anchor: right | vcenter;
        }
        titleBottom {
                type: combined;
                foreground: titlePolygonLeft;
                background: titleGradient;
        }
        titlePolygonLeft {
                type: polygon;
                points: 10,50 50,10 90,50 50,90;
                color: #d0f;
                scale-mode: proportional;
                anchor: left | vcenter;
        }
        titleGradient {
                type: vertical-gradient;
                top-color: white;
                bottom-color: blue;
        }
}

title {
        padding: 2;
        margin-top: 0;
        margin-bottom: 5;
        margin-left: 0;
        margin-right: 0;
        font-face: proportional;
        font-size: large;
        font-style: bold;
        font-color: brightFontColor;
        border: none;
        layout: horizontal-center | horizontal-expand;

        background {
                type: combined;
                foreground: titleTop;
                background: titleBottom;
        }
}
 

Copyright Enough Software 2007 - 2008

 history
        Nov 21, 2007 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
 
Fields inherited from class de.enough.polish.ui.Background
borderWidth
 
Constructor Summary
CombinedBackground(Background foreground, Background background)
          Creates a new combiend background.
 
Method Summary
 void animate(Screen screen, Item parent, long currentTime, ClippingRegion repaintRegion)
          Animates this background.
 void hideNotify()
          Informs the background that it is being hidden shortly.
 void paint(int x, int y, int width, int height, javax.microedition.lcdui.Graphics g)
          Paints this background.
 void releaseResources()
          Releases all (memory intensive) resources such as images or RGB arrays of this background.
 void showNotify()
          Informs the background that it is being shown shortly or that it is now applied to a new visible item.
 
Methods inherited from class de.enough.polish.ui.Background
addRelativeToBackgroundRegion, animate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedBackground

public CombinedBackground(Background foreground,
                          Background background)
Creates a new combiend background.

Parameters:
foreground - the background painted last
background - the background painted in the background
Method Detail

paint

public void paint(int x,
                  int y,
                  int width,
                  int height,
                  javax.microedition.lcdui.Graphics g)
Description copied from class: Background
Paints this background.

Specified by:
paint in class Background
Parameters:
x - the horizontal start point
y - the vertical start point
width - the width of the background
height - the height of the background
g - the Graphics on which the background should be painted.

animate

public void animate(Screen screen,
                    Item parent,
                    long currentTime,
                    ClippingRegion repaintRegion)
Description copied from class: Background
Animates this background. Subclasses can override this method to create animations. The default implementation calls the animate() method and adds the full content area to the repaint region.

Overrides:
animate in class Background
Parameters:
screen - the parent screen
parent - the parent item, can be null when the background belongs to a screen
currentTime - the current time in milliseconds
repaintRegion - the repaint area that needs to be updated when this item is animated
See Also:
Item.addRelativeToContentRegion(ClippingRegion, int, int, int, int)

showNotify

public void showNotify()
Description copied from class: Background
Informs the background that it is being shown shortly or that it is now applied to a new visible item. The default implementation is empty.

Overrides:
showNotify in class Background

hideNotify

public void hideNotify()
Description copied from class: Background
Informs the background that it is being hidden shortly. The default implementation is empty.

Overrides:
hideNotify in class Background

releaseResources

public void releaseResources()
Description copied from class: Background
Releases all (memory intensive) resources such as images or RGB arrays of this background. The default implementation does not do anything.

Overrides:
releaseResources in class Background