net.yura.mobile.gui.components
Class Button

java.lang.Object
  extended by net.yura.mobile.gui.components.Component
      extended by net.yura.mobile.gui.components.Label
          extended by net.yura.mobile.gui.components.Button
All Implemented Interfaces:
ActionListener
Direct Known Subclasses:
ButtonEditor, ComboBox, Menu, RadioButton

public class Button
extends Label
implements ActionListener

Author:
Yura Mamyrin
See Also:
JButton

Field Summary
protected  ButtonGroup buttonGroup
           
 
Fields inherited from class net.yura.mobile.gui.components.Label
alignment, extension, font, gap, icon, padding, string, textPosition
 
Fields inherited from class net.yura.mobile.gui.components.Component
background, empty, FOCUS_GAINED, FOCUS_LOST, focusable, foreground, height, parent, posX, posY, preferredHeight, preferredWidth, state, theme, width
 
Constructor Summary
Button()
           
Button(String label)
           
Button(String label, Icon img)
           
 
Method Summary
 void actionPerformed(String actionCommand)
           
 void addActionListener(ActionListener l)
           
 void fireActionPerformed()
           
 void focusGained()
           
 void focusLost()
           
 String getActionCommand()
           
 ActionListener[] getActionListeners()
           
 String getDefaultName()
           
 int getMnemonic()
           
 int getState()
           
 Object getValue()
           
 int getXOnScreen()
           
 int getYOnScreen()
           
 boolean isSelected()
           
 boolean isUseSelectButton()
           
 boolean isVisible()
           
 boolean processKeyEvent(KeyEvent keyEvent)
           
 void processMouseEvent(int type, int x, int y, KeyEvent keys)
           
 void removeActionListener(ActionListener l)
           
 void setActionCommand(String ac)
           
 void setButtonGroup(ButtonGroup buttonGroup)
           
 void setMnemonic(int m)
           When set to KeyEvent.KEY_MENU this will be activated by the 'Alt' key in ME4SE and appear as 'Left SoftKey' of J2ME phones On Android and blackberry it will be hidden from the layout and activated by the 'MENU' button
 void setSelected(boolean selected)
           
 void setUseSelectButton(boolean useSelectButton)
           
 void setValue(Object obj)
           
protected  void toggleSelection()
          This method is ONLY used when we do NOT have a button group
 void updateUI()
           
 
Methods inherited from class net.yura.mobile.gui.components.Label
getCombinedHeight, getCombinedHeight, getCombinedWidth, getCombinedWidth, getFont, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getMargin, getMaxWidth, getText, getVerticalAlignment, getVerticalTextPosition, paintComponent, paintIcon, setFont, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setMargin, setText, setVerticalAlignment, setVerticalTextPosition, toString, workoutMinimumSize
 
Methods inherited from class net.yura.mobile.gui.components.Component
add, add, add, addFocusListener, addImpl, animate, clip, consumesMotionEvents, getBackground, getBorder, getCurrentState, getDesktopPane, getFocusListeners, getForeground, getHeight, getHeightWithBorder, getInsets, getName, getParent, getPreferredHeight, getPreferredWidth, getToolTipLocationX, getToolTipLocationY, getToolTipText, getWidth, getWidthWithBorder, getWindow, getX, getXWithBorder, getY, getYWithBorder, insert, insert, isComponentVisible, isFocusable, isFocusOwner, isOpaque, isRectVisible, isShowing, makeVisible, paint, paintBorder, processMultitouchEvent, removeFocusListener, removeParent, repaint, requestFocusInWindow, revalidate, scrollRectToVisible, scrollUpDown, setBackground, setBorder, setBounds, setBoundsWithBorder, setFocusable, setForeground, setLocation, setName, setPreferredSize, setSize, setState, setToolTipText, setupState, setVisible, transferFocus, validate, wait, workoutSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttonGroup

protected ButtonGroup buttonGroup
Constructor Detail

Button

public Button()
See Also:
JButton.JButton

Button

public Button(String label)
Parameters:
label - the text of the button
See Also:
JButton.JButton

Button

public Button(String label,
              Icon img)
Parameters:
label - the text of the button
img - the Icon image to display on the button
See Also:
JButton.JButton
Method Detail

actionPerformed

public void actionPerformed(String actionCommand)
Specified by:
actionPerformed in interface ActionListener
Parameters:
actionCommand - The Command of the action
See Also:
ActionListener.actionPerformed

addActionListener

public void addActionListener(ActionListener l)
See Also:
AbstractButton.addActionListener

fireActionPerformed

public void fireActionPerformed()
See Also:
AbstractButton.fireActionPerformed

focusGained

public void focusGained()
Overrides:
focusGained in class Component
See Also:
FocusListener.focusGained

focusLost

public void focusLost()
Overrides:
focusLost in class Component
See Also:
FocusListener.focusLost

getActionCommand

public String getActionCommand()
Returns:
The Action Command for this button
See Also:
AbstractButton.getActionCommand

getActionListeners

public ActionListener[] getActionListeners()
See Also:
AbstractButton.getActionListeners

getDefaultName

public String getDefaultName()
Overrides:
getDefaultName in class Label

getMnemonic

public int getMnemonic()
See Also:
AbstractButton.getMnemonic

getState

public int getState()
Overrides:
getState in class Component

getValue

public Object getValue()
Overrides:
getValue in class Component

getXOnScreen

public int getXOnScreen()
Overrides:
getXOnScreen in class Component
See Also:
Component.getLocationOnScreen

getYOnScreen

public int getYOnScreen()
Overrides:
getYOnScreen in class Component
See Also:
Component.getLocationOnScreen

isSelected

public boolean isSelected()
See Also:
AbstractButton.isSelected

isUseSelectButton

public boolean isUseSelectButton()

isVisible

public boolean isVisible()
Overrides:
isVisible in class Component
See Also:
Component.isVisible

processKeyEvent

public boolean processKeyEvent(KeyEvent keyEvent)
Overrides:
processKeyEvent in class Component
See Also:
JComponent.processKeyEvent

processMouseEvent

public void processMouseEvent(int type,
                              int x,
                              int y,
                              KeyEvent keys)
Overrides:
processMouseEvent in class Component
See Also:
Component.processMouseEvent

removeActionListener

public void removeActionListener(ActionListener l)
See Also:
AbstractButton.removeActionListener

setActionCommand

public void setActionCommand(String ac)
Parameters:
ac - The Action Command for this button
See Also:
AbstractButton.setActionCommand

setButtonGroup

public void setButtonGroup(ButtonGroup buttonGroup)

setMnemonic

public void setMnemonic(int m)

When set to KeyEvent.KEY_MENU this will be activated by the 'Alt' key in ME4SE and appear as 'Left SoftKey' of J2ME phones On Android and blackberry it will be hidden from the layout and activated by the 'MENU' button

When set to KeyEvent.KEY_END this will be activated by the 'Esc' key in ME4SE and appear as 'Right SoftKey' of J2ME phones On Android and blackberry it will be hidden from the layout and activated by the 'BACK' button

When set to KeyEvent.KEY_SOFTKEY1 this will be activated by the 'F1' key in ME4SE and appear as 'Left SoftKey' of J2ME phones. On Android and blackberry nothing special will be done with this button

When set to KeyEvent.KEY_SOFTKEY2 this will be activated by the 'F2' key in ME4SE and appear as 'Right SoftKey' of J2ME phones. On Android and blackberry nothing special will be done with this button

See Also:
AbstractButton.setMnemonic, KeyEvent.KEY_MENU, KeyEvent.KEY_END, KeyEvent.KEY_SOFTKEY1, KeyEvent.KEY_SOFTKEY2

setSelected

public void setSelected(boolean selected)
See Also:
AbstractButton.setSelected

setUseSelectButton

public void setUseSelectButton(boolean useSelectButton)

setValue

public void setValue(Object obj)
Overrides:
setValue in class Label

toggleSelection

protected void toggleSelection()
This method is ONLY used when we do NOT have a button group


updateUI

public void updateUI()
Overrides:
updateUI in class Label
See Also:
JComponent.updateUI