org.j4me.ui.components
Class HorizontalRule

java.lang.Object
  extended by org.j4me.ui.components.Component
      extended by org.j4me.ui.components.HorizontalRule

public class HorizontalRule
extends Component

A horizontal rule component. It is a line across the screen used to demarkate sections of a form.


Field Summary
 
Fields inherited from class org.j4me.ui.components.Component
container, HIGHLIGHTED_BORDER_WIDTH
 
Constructor Summary
HorizontalRule()
          Constructs a horizontal rule component.
 
Method Summary
 int getHeight()
          Returns how many pixels high the horizontal rule is.
protected  int[] getPreferredComponentSize(Theme theme, int viewportWidth, int viewportHeight)
          Returns the size of the horizontal rule.
 double getWidthOfScreen()
          Gets how far across the screen the line extends.
protected  void paintComponent(javax.microedition.lcdui.Graphics g, Theme theme, int width, int height, boolean selected)
          Paints the horizontal rule.
 void setHeight(int pixels)
          Sets the height of the horizontal line rule in pixels.
 void setWidthOfScreen(double percentageOfScreen)
          Sets how far across the screen the line extends.
 
Methods inherited from class org.j4me.ui.components.Component
acceptsInput, getHorizontalAlignment, getPreferredSize, getScreen, getWidth, getX, getY, hideNotify, invalidate, isShown, keyPressed, keyReleased, keyRepeated, paint, paintRect, pointerDragged, pointerPressed, pointerReleased, repaint, setHorizontalAlignment, showNotify, visible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HorizontalRule

public HorizontalRule()
Constructs a horizontal rule component.

Method Detail

setWidthOfScreen

public void setWidthOfScreen(double percentageOfScreen)
Sets how far across the screen the line extends.

Parameters:
percentageOfScreen - is the length of the line relative to the width of the screen. It must be between 0.00 and 1.00.

getWidthOfScreen

public double getWidthOfScreen()
Gets how far across the screen the line extends.

Returns:
The length of the line relative to the width of the screen.

setHeight

public void setHeight(int pixels)
Sets the height of the horizontal line rule in pixels.

Parameters:
pixels - is how many pixels high the horizontal line will be. It must be at least 1.

getHeight

public int getHeight()
Returns how many pixels high the horizontal rule is. The default is 1.

Overrides:
getHeight in class Component
Returns:
The number of pixels high the horizontal rule is.

paintComponent

protected void paintComponent(javax.microedition.lcdui.Graphics g,
                              Theme theme,
                              int width,
                              int height,
                              boolean selected)
Paints the horizontal rule.

Specified by:
paintComponent in class Component
Parameters:
g - is the Graphics object to be used for rendering the item.
theme - is the application's theme. Use it to get fonts and colors.
width - is the width, in pixels, to paint the component.
height - is the height, in pixels, to paint the component.
selected - is true when this components is currently selected and false when it is not.
See Also:
Component.paintComponent(javax.microedition.lcdui.Graphics, org.j4me.ui.Theme, int, int, boolean)

getPreferredComponentSize

protected int[] getPreferredComponentSize(Theme theme,
                                          int viewportWidth,
                                          int viewportHeight)
Returns the size of the horizontal rule.

Specified by:
getPreferredComponentSize in class Component
Parameters:
theme - is the application's Theme.
viewportWidth - is the width of the viewable area, in pixels, the component can use.
viewportHeight - is the height of the viewable area, in pixels, the component can use.
Returns:
A array with two elements where the first is the width of the component in pixels and the second is the height.
See Also:
Component.getPreferredComponentSize(org.j4me.ui.Theme, int, int)