Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jcurses.widgets
Class PopUpMenu  view PopUpMenu download PopUpMenu.java

java.lang.Object
  extended byjcurses.widgets.PopUpMenu
All Implemented Interfaces:
jcurses.event.ItemListener, WidgetsConstants

public class PopUpMenu
extends java.lang.Object
implements WidgetsConstants, jcurses.event.ItemListener

This class implements a popup menu window. Such windows can be used for example to implemene menu bars ( currently not cantained in the library ). A popup menu window gives a user the possibility to select and ivoke an item from a list and is than closed. Separator items can be used as by MenuList described.


Field Summary
private  MenuList _menuList
           
(package private)  Dialog _peer
           
private  int _selectedIndex
           
private  java.lang.String _selectedItem
           
(package private)  java.lang.String _title
           
private  int _x
           
private  int _y
           
 
Fields inherited from interface jcurses.widgets.WidgetsConstants
ALIGNMENT_BOTTOM, ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP
 
Constructor Summary
PopUpMenu(int x, int y, java.lang.String title)
          The constructor
 
Method Summary
 void add(int pos, java.lang.String item)
          Adds an item at the specified position
 void add(java.lang.String item)
          Adds an item at the end of the list.
 void addSeparator()
          Adds a separator at the end of the list.
 void addSeparator(int index)
          Adds a separator item at the specified position
 java.lang.String getItem(int index)
           
 int getItemsCount()
           
 int getSelectedIndex()
          Returns the last selected index.
 java.lang.String getSelectedItem()
          Returns the last selected item.
 void remove(int pos)
          Removes the item at the specified position
 void remove(java.lang.String item)
          Removes the first ocuurence of the specified item
 void show()
          Makes the window visible.
 void stateChanged(jcurses.event.ItemEvent e)
          The method will be called by an widget, generating ItemEvent instances, if the listener has been registered by it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_menuList

private MenuList _menuList

_peer

Dialog _peer

_x

private int _x

_y

private int _y

_title

java.lang.String _title

_selectedIndex

private int _selectedIndex

_selectedItem

private java.lang.String _selectedItem
Constructor Detail

PopUpMenu

public PopUpMenu(int x,
                 int y,
                 java.lang.String title)
The constructor

Method Detail

show

public void show()
Makes the window visible. Blocks, until the window is closed.


addSeparator

public void addSeparator(int index)
Adds a separator item at the specified position


addSeparator

public void addSeparator()
Adds a separator at the end of the list.


add

public void add(int pos,
                java.lang.String item)
Adds an item at the specified position


add

public void add(java.lang.String item)
Adds an item at the end of the list.


getItemsCount

public int getItemsCount()

getItem

public java.lang.String getItem(int index)

remove

public void remove(int pos)
Removes the item at the specified position


remove

public void remove(java.lang.String item)
Removes the first ocuurence of the specified item


stateChanged

public void stateChanged(jcurses.event.ItemEvent e)
Description copied from interface: jcurses.event.ItemListener
The method will be called by an widget, generating ItemEvent instances, if the listener has been registered by it.

Specified by:
stateChanged in interface jcurses.event.ItemListener

getSelectedIndex

public int getSelectedIndex()
Returns the last selected index. Should be invoked after the return of the show to get the result


getSelectedItem

public java.lang.String getSelectedItem()
Returns the last selected item. Should be invoked after the return of the show to get the result