de.enough.polish.ui.backgrounds
Class HorizontalBackground

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

public class HorizontalBackground
extends Background

Places two further backgrounds side by side.

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

Copyright Enough Software 2008

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
 
Fields inherited from class de.enough.polish.ui.Background
borderWidth
 
Constructor Summary
HorizontalBackground(Background leftBackground, Background rightBackground, int splitPos, int splitSide, int margin)
          Creates a new horizontal 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

HorizontalBackground

public HorizontalBackground(Background leftBackground,
                            Background rightBackground,
                            int splitPos,
                            int splitSide,
                            int margin)
Creates a new horizontal background.

Parameters:
leftBackground - the background painted left
rightBackground - the background painted right
splitPos - the split position either in percent (0 - 100) or in pixels, negative values are interpreted as percent values
splitSide - the side of the splitPos
margin - the margin between the backgrounds - can be negative for overlapping
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