All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jcurses.event.ItemEvent Maven / Gradle / Ivy

Go to download

Internal Version of JCurses for use with Kolja. For projects please use http://sourceforge.net/projects/javacurses/

The newest version!
package jcurses.event;

import jcurses.widgets.Widget;
/**
*  Instances of this class are generated by widgets, that manage a list of items,
*  an example is list widget.  
*/

public class ItemEvent extends Event {
	
	private int _id=0;
	private Object _item = null; 
	private int _type = 0;
	
	
	public static final int SELECTED = 0;
	public static final int DESELECTED = 1;
	public static final int CALLED = 2;
	
	
    /**
    *  The constructor
    * 
    * @param source the widget, that has generated this event
    * @param id the id of the affected item
    * @param item the content of the affected item, in order this is a string.
    * @param type the type of the event, must be equal to one of following three constants:
    *       
SELECTED - the event signals, that an item is selected by the user *
DESELECTED - the event signals, that an item is deselected by the user *
CALLED - the event signals, that an item is 'called' by the user, this is * in order activated with the cursor an pushed 'enter' key */ public ItemEvent(Widget source, int id, Object item, int type) { super(source); _id = id; _item = item; _type = type; } /** * @return the id (key) of the affected item */ public int getId() { return _id; } /** * @return the type of the event. Only possible values: SELECTED,DESELECTED,CALLED */ public int getType() { return _type; } /** * @return the content of the affected item */ public Object getItem() { return _item; } }