net.yura.mobile.gui.components
Class List

java.lang.Object
  extended by net.yura.mobile.gui.components.Component
      extended by net.yura.mobile.gui.components.List
All Implemented Interfaces:
ActionListener
Direct Known Subclasses:
MenuBar

public class List
extends Component
implements ActionListener

if you would like the list to wrap the items then please use GridList

Author:
Yura Mamyrin
See Also:
FileChooser.GridList, JList

Field Summary
static int HORIZONTAL
          Not supported in Swing
static int VERTICAL
           
 
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
List()
           
List(ListCellRenderer a)
           
List(Vector a)
           
List(Vector a, ListCellRenderer b, int h)
           
 
Method Summary
 void actionPerformed(String actionCommand)
           
 void addActionListener(ActionListener l)
           
 void addChangeListener(ChangeListener aThis)
           
 void addElement(Object a)
           
 void clearSelection()
           
 boolean consumesMotionEvents()
           
 void contentsChanged()
           
 void ensureIndexIsVisible(int i)
           
 boolean fireActionPerformed()
           
 void focusGained()
           
 void focusLost()
           
 String getActionCommand()
           
 ActionListener getActionListener()
           
 ListCellRenderer getCellRenderer()
           
protected  Component getComponentFor(int i, int offset)
           
 String getDefaultName()
           
 Object getElementAt(int index)
           
 int getFixedCellHeight()
           
 Vector getItems()
          not swing
 int getLayoutOrientation()
           
 Component getRendererComponentFor(int a)
           
 int getSelectedIndex()
           
 Object getSelectedValue()
           
 Vector getSelectedValues()
           
 int getSize()
           
 int getToolTipLocationX()
           
 int getToolTipLocationY()
           
 String getToolTipText()
           
 int indexOf(Object a)
           
 void insertElementAt(Object object, int index)
           
 boolean isSelectedIndex(int index)
           
 boolean isUseSelectButton()
           
 void paintComponent(Graphics2D g)
           
 boolean processKeyEvent(KeyEvent keypad)
           
 void processMouseEvent(int type, int x, int y, KeyEvent keys)
           
 void removeActionListener(ActionListener l)
           
 void removeAllElements()
           
 boolean removeElement(Object obj)
           
 void removeElementAt(int i)
           
 void setActionCommand(String ac)
           
 void setCellRenderer(ListCellRenderer cellRenderer)
           
 void setDoubleClick(boolean b)
           
 void setElementAt(Object object, int index)
           
 void setFixedCellHeight(int height)
           
 void setFixedCellWidth(int width)
           
 void setLayoutOrientation(int layoutOrientation)
           
 void setListData(Vector a)
           
 void setLoop(boolean l)
           
 void setPrototypeCellValue(Object prototypeCellValue)
          maybe should be in list, but is used in a few places
 void setSelectedIndex(int a)
           
 void setSelectedIndex(int a, boolean moveScroll)
           
 void setSelectedValue(Object a)
           
 void setSelectedValues(Vector v)
           
 void setSize(int w, int h)
           
 void setUseSelectButton(boolean useSelectButton)
           
 String toString()
           
 void updateUI()
           
 void workoutMinimumSize()
          This sets the width and height of this component to the MINIMUM that is needed for this component
 
Methods inherited from class net.yura.mobile.gui.components.Component
add, add, add, addFocusListener, addImpl, animate, clip, getBackground, getBorder, getCurrentState, getDesktopPane, getFocusListeners, getForeground, getHeight, getHeightWithBorder, getInsets, getName, getParent, getPreferredHeight, getPreferredWidth, getState, getValue, getWidth, getWidthWithBorder, getWindow, getX, getXOnScreen, getXWithBorder, getY, getYOnScreen, getYWithBorder, insert, insert, isComponentVisible, isFocusable, isFocusOwner, isOpaque, isRectVisible, isShowing, isVisible, makeVisible, paint, paintBorder, processMultitouchEvent, removeFocusListener, removeParent, repaint, requestFocusInWindow, revalidate, scrollRectToVisible, scrollUpDown, setBackground, setBorder, setBounds, setBoundsWithBorder, setFocusable, setForeground, setLocation, setName, setPreferredSize, setState, setToolTipText, setupState, setValue, setVisible, transferFocus, validate, wait, workoutSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Not supported in Swing

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
See Also:
JList.VERTICAL, Constant Field Values
Constructor Detail

List

public List()
See Also:
JList.JList

List

public List(ListCellRenderer a)

List

public List(Vector a)
Parameters:
a -
See Also:
JList.JList

List

public List(Vector a,
            ListCellRenderer b,
            int h)
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)

addChangeListener

public void addChangeListener(ChangeListener aThis)

addElement

public void addElement(Object a)
Parameters:
a -
See Also:
DefaultListModel.addElement

clearSelection

public void clearSelection()
See Also:
JList.clearSelection, ListSelectionModel.clearSelection

consumesMotionEvents

public boolean consumesMotionEvents()
Overrides:
consumesMotionEvents in class Component

contentsChanged

public void contentsChanged()
See Also:
ListDataListener.contentsChanged

ensureIndexIsVisible

public void ensureIndexIsVisible(int i)
See Also:
JList.ensureIndexIsVisible

fireActionPerformed

public boolean 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()

getActionListener

public ActionListener getActionListener()

getCellRenderer

public ListCellRenderer getCellRenderer()
Returns:
the ListCellRenderer
See Also:
JList.getCellRenderer

getComponentFor

protected Component getComponentFor(int i,
                                    int offset)

getDefaultName

public String getDefaultName()
Specified by:
getDefaultName in class Component

getElementAt

public Object getElementAt(int index)
Parameters:
index -
Returns:
the element
See Also:
ListModel.getElementAt

getFixedCellHeight

public int getFixedCellHeight()

getItems

public Vector getItems()
not swing


getLayoutOrientation

public int getLayoutOrientation()
See Also:
JList.getLayoutOrientation

getRendererComponentFor

public Component getRendererComponentFor(int a)

getSelectedIndex

public int getSelectedIndex()
Returns:
the first selected index; returns -1 if there is no selected item
See Also:
JList.getSelectedIndex

getSelectedValue

public Object getSelectedValue()
Returns:
the first selected value, or null if the selection is empty
See Also:
JList.getSelectedValue

getSelectedValues

public Vector getSelectedValues()
See Also:
JList.getSelectedValues

getSize

public int getSize()
Returns:
the size of the list
See Also:
ListModel.getSize

getToolTipLocationX

public int getToolTipLocationX()
Overrides:
getToolTipLocationX in class Component
See Also:
JComponent.getToolTipLocation

getToolTipLocationY

public int getToolTipLocationY()
Overrides:
getToolTipLocationY in class Component
See Also:
JComponent.getToolTipLocation

getToolTipText

public String getToolTipText()
Overrides:
getToolTipText in class Component
See Also:
JComponent.getToolTipText, JComponent.getToolTipText

indexOf

public int indexOf(Object a)
See Also:
DefaultListModel.indexOf

insertElementAt

public void insertElementAt(Object object,
                            int index)
Parameters:
index -
See Also:
ListModel.insertElementAt

isSelectedIndex

public boolean isSelectedIndex(int index)
See Also:
ListSelectionModel.isSelectedIndex

isUseSelectButton

public boolean isUseSelectButton()

paintComponent

public void paintComponent(Graphics2D g)
Specified by:
paintComponent in class Component
See Also:
JComponent.paintComponent

processKeyEvent

public boolean processKeyEvent(KeyEvent keypad)
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)

removeAllElements

public void removeAllElements()
See Also:
DefaultListModel#removeAllElements

removeElement

public boolean removeElement(Object obj)
Parameters:
obj - the object to remove
See Also:
DefaultListModel#removeElement

removeElementAt

public void removeElementAt(int i)
Parameters:
i -
See Also:
DefaultListModel#removeElementAt

setActionCommand

public void setActionCommand(String ac)

setCellRenderer

public void setCellRenderer(ListCellRenderer cellRenderer)
Parameters:
cellRenderer -
See Also:
JList.setCellRenderer

setDoubleClick

public void setDoubleClick(boolean b)

setElementAt

public void setElementAt(Object object,
                         int index)
Parameters:
index -
See Also:
ListModel.setElementAt

setFixedCellHeight

public void setFixedCellHeight(int height)
Parameters:
height -
See Also:
JList.setFixedCellHeight

setFixedCellWidth

public void setFixedCellWidth(int width)
Parameters:
width -
See Also:
JList.setFixedCellWidth

setLayoutOrientation

public void setLayoutOrientation(int layoutOrientation)
See Also:
JList.setLayoutOrientation

setListData

public void setListData(Vector a)
Parameters:
a -
See Also:
JList.setListData

setLoop

public void setLoop(boolean l)

setPrototypeCellValue

public void setPrototypeCellValue(Object prototypeCellValue)
maybe should be in list, but is used in a few places

See Also:
JList.setPrototypeCellValue

setSelectedIndex

public void setSelectedIndex(int a)
Parameters:
a - the index of the one cell to select
See Also:
JList.setSelectedIndex

setSelectedIndex

public void setSelectedIndex(int a,
                             boolean moveScroll)
Parameters:
a - the index ofthe one cell to select
moveScroll - if true the scroll positon of the list will be modified to make the newly selected index visible

setSelectedValue

public void setSelectedValue(Object a)
Parameters:
a - the object to select
See Also:
JList.setSelectedValue

setSelectedValues

public void setSelectedValues(Vector v)
See Also:
JList.setSelectedValue

setSize

public void setSize(int w,
                    int h)
Overrides:
setSize in class Component
See Also:
Component.setSize

setUseSelectButton

public void setUseSelectButton(boolean useSelectButton)

toString

public String toString()
Overrides:
toString in class Component
See Also:
Component.toString

updateUI

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

workoutMinimumSize

public void workoutMinimumSize()
Description copied from class: Component
This sets the width and height of this component to the MINIMUM that is needed for this component

Specified by:
workoutMinimumSize in class Component
See Also:
JComponent.getMinimumSize