org.netbeans.microedition.lcdui
Class LoginScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by org.netbeans.microedition.lcdui.LoginScreen
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener

public class LoginScreen
extends javax.microedition.lcdui.Canvas
implements javax.microedition.lcdui.CommandListener

The LoginScreen custom component provides usefully UI with standard elements like Username Filed, Password Field and Login Button


Field Summary
static javax.microedition.lcdui.Command LOGIN_COMMAND
           
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
LoginScreen(javax.microedition.lcdui.Display display)
          Creates a new instance of LoginScreen for given Display object.
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
          Indicates that a command event has occurred on Displayable d.
 ColorSchema getColorSchema()
          Returns component's color schema.
 javax.microedition.lcdui.CommandListener getCommandListener()
          Returns command listener.
 javax.microedition.lcdui.Display getDisplay()
          Returns dispaly object.
 java.lang.String getPassword()
          Returns login password
 java.lang.String getUsername()
          Returns login username
protected  void keyPressed(int keyCode)
          Called when a key is pressed.
protected  void keyReleased(int keyCode)
          Called when a key is released.
protected  void paint(javax.microedition.lcdui.Graphics graphics)
          Paints this canvas.
 void setBackgroundImageAnchorPoint(int anchorPoint)
          Sets backbround image anchor point.
 void setBGColor(int color)
          Sets component's background color.
 void setCommandListener(javax.microedition.lcdui.CommandListener l)
          Sets component's command listener.
 void setDefaulBorderStyles()
          Sets default border styles.
 void setDefaultFonts()
          Default border styles.
 void setFGColor(int color)
          Sets component's foreground color.
 void setFonts(javax.microedition.lcdui.Font titleFont, javax.microedition.lcdui.Font inputFont, javax.microedition.lcdui.Font loginButtonFont)
          Sets login screen fonts.
 void setLabelTexts(java.lang.String usernameLabel, java.lang.String passwordLabel)
          Sets username and password label.
 void setLoginTitle(java.lang.String loginTitleText)
          Sets login title text.
 void setPassword(java.lang.String password)
          Sets predefined login password.
 void setUseLoginButton(boolean useLoginButton)
          Sets use of the login button.
 void setUsername(java.lang.String username)
          Sets predefined login username.
protected  void showNotify()
          The implementation calls showNotify() immediately prior to this Canvas being made visible on the display.
protected  void sizeChanged(int w, int h)
          Called when the drawable area of the Canvas has been changed.
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setFullScreenMode
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_COMMAND

public static javax.microedition.lcdui.Command LOGIN_COMMAND
Constructor Detail

LoginScreen

public LoginScreen(javax.microedition.lcdui.Display display)
Creates a new instance of LoginScreen for given Display object.

Parameters:
display - a non-null Display object.
Method Detail

setUsername

public void setUsername(java.lang.String username)
Sets predefined login username.

Parameters:
username - predifined login username

getUsername

public java.lang.String getUsername()
Returns login username

Returns:
non null String value

setPassword

public void setPassword(java.lang.String password)
Sets predefined login password.

Parameters:
password - predefined login password

getPassword

public java.lang.String getPassword()
Returns login password

Returns:
non null String value

setLoginTitle

public void setLoginTitle(java.lang.String loginTitleText)
Sets login title text.

Parameters:
loginTitleText - login title text

setUseLoginButton

public void setUseLoginButton(boolean useLoginButton)
Sets use of the login button.

Parameters:
useLoginButton - Boolean.TRUE login buton in used, Boolean.FALSE login button is NOT used

setLabelTexts

public void setLabelTexts(java.lang.String usernameLabel,
                          java.lang.String passwordLabel)
Sets username and password label.

Parameters:
usernameLabel - username label
passwordLabel - password label

getDisplay

public javax.microedition.lcdui.Display getDisplay()
Returns dispaly object.

Returns:
non null Display object

setDefaulBorderStyles

public void setDefaulBorderStyles()
Sets default border styles.


setDefaultFonts

public void setDefaultFonts()
Default border styles.


setFonts

public void setFonts(javax.microedition.lcdui.Font titleFont,
                     javax.microedition.lcdui.Font inputFont,
                     javax.microedition.lcdui.Font loginButtonFont)
Sets login screen fonts.

Parameters:
titleFont - fonts used in title
inputFont - font used in username and password text fields
loginButtonFont - fonts used in login button

setBackgroundImageAnchorPoint

public void setBackgroundImageAnchorPoint(int anchorPoint)
Sets backbround image anchor point.

Parameters:
anchorPoint - image anchor paint

showNotify

protected void showNotify()
The implementation calls showNotify() immediately prior to this Canvas being made visible on the display. Canvas subclasses may override this method to perform tasks before being shown, such as setting up animations, starting timers, etc.

Overrides:
showNotify in class javax.microedition.lcdui.Canvas

sizeChanged

protected void sizeChanged(int w,
                           int h)
Called when the drawable area of the Canvas has been changed. This method has augmented semantics compared to Displayable.sizeChanged. In addition to the causes listed in Displayable.sizeChanged, a size change can occur on a Canvas because of a change between normal and full-screen modes. If the size of a Canvas changes while it is actually visible on the display, it may trigger an automatic repaint request. If this occurs, the call to size Changed will occur prior to the call to paint. If the Canvas has become smaller, the implementation may choose not to trigger a repaint request if the remaining contents of the Canvas have been preserved. Similarly, if the Canvas has become larger, the implementation may choose to trigger a repaint only for the new region. In both cases, the preserved contents must remain stationary with respect to the origin of the Canvas. If the size change is significant to the contents of the Canvas, the application must explicitly issue a repaint request for the changed areas. Note that the application's repaint request should not cause multiple repaints, since it can be coalesced with repaint requests that are already pending. If the size of a Canvas changes while it is not visible, the implementation may choose to delay calls to sizeChanged until immediately prior to the call to showNotify. In that case, there will be only one call to sizeChanged, regardless of the number of size changes. An application that is sensitive to size changes can update instance variables in its implementation of sizeChanged. These updated values will be available to the code in the showNotify, hideNotify, and paint methods.

Overrides:
sizeChanged in class javax.microedition.lcdui.Canvas
Parameters:
w - the new width in pixels of the drawable area of the Canvas
h - the new height in pixels of the drawable area of the Canvas

getColorSchema

public ColorSchema getColorSchema()
Returns component's color schema.

Returns:
component's color schema

paint

protected void paint(javax.microedition.lcdui.Graphics graphics)
Paints this canvas.

Specified by:
paint in class javax.microedition.lcdui.Canvas
Parameters:
graphics - the Graphics object to be used for rendering the Canvas

keyReleased

protected void keyReleased(int keyCode)
Called when a key is released.

Overrides:
keyReleased in class javax.microedition.lcdui.Canvas
Parameters:
keyCode - the key code of the key that was released

keyPressed

protected void keyPressed(int keyCode)
Called when a key is pressed.

Overrides:
keyPressed in class javax.microedition.lcdui.Canvas
Parameters:
keyCode - the key code of the key that was pressed

setCommandListener

public void setCommandListener(javax.microedition.lcdui.CommandListener l)
Sets component's command listener.

Overrides:
setCommandListener in class javax.microedition.lcdui.Displayable
Parameters:
l - CommandListener

getCommandListener

public javax.microedition.lcdui.CommandListener getCommandListener()
Returns command listener.

Returns:
commandListener non null CommandListener object

setBGColor

public void setBGColor(int color)
Sets component's background color.

Parameters:
color - background color

setFGColor

public void setFGColor(int color)
Sets component's foreground color.

Parameters:
color - foreground color

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
Indicates that a command event has occurred on Displayable d.

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
Parameters:
c - a Command object identifying the command. This is either one of the applications have been added to Displayable with addCommand(Command) or is the implicit SELECT_COMMAND of List.
d - the Displayable on which this event has occurred