org.gnu.gtk

Class Combo


public class Combo
extends HBox

The Combo box displays a single item and provides a pull-down list of items that can be selected. The drop-down list is displayed when the user clicks on a small arrow button to the right of the entry field.

By default, the user can step through the items in the list by using the arrow keys, though this behavior can be turned off with the setUseArrows() method.

Normally the arrow keys are only active when the contents of the text entry field matches on of the items in the list. If the contents of the entry field do not match any of the items in the list items, then pressing the arrow keys does nothing. However, by calling the setUseArrowsAlways() method you can specify that the arrow keys be active always.

Constructor Summary

Combo()
Construct a new Combo widget.
Combo(Handle handle)
Construct a new Combo from a handle to a native resource.

Method Summary

void
disableActivate()
Stops the Combo widget from showing the popup list when the Entry emits the "activate" signal, i.e., when the return key is pressed.
Entry
getEntry()
Get the Entry field that is a part of this combo.
String
getText()
Retrieve the text from the combo.
static Type
getType()
Retrieve the runtime type used by the GLib library.
void
setCaseSensitive(boolean val)
Specifies whether the text entered into the Entry field and the text in the line items are case sensitive.
void
setItemString(Item item, String itemValue)
Sets the string to place in the Entry field when a particular item is selected.
void
setPopupdownStrings(String[] values)
Convenience method to set all of the items in the popupdown list.
void
setUseArrorwsAlways(boolean val)
Specifies if the arrow keys will still work even if the current contents of the Entry field do not match any of the items in the list.
void
setUseArrows(boolean val)
Specifies if the arrow (cursor) keys can be used to step through the items in the list.
void
setValueInList(boolean val, boolean okifEmpty)
Specifies whether the value entered in the text entry field must match one of the values in the list.

Methods inherited from class org.gnu.gtk.HBox

getHBox, getType

Methods inherited from class org.gnu.gtk.Box

getHomogeneous, getSpacing, getType, packEnd, packEnd, packStart, packStart, reorderChild, setHomogeneous, setSpacing

Methods inherited from class org.gnu.gtk.Container

add, addListener, getBooleanChildProperty, getBorderWidth, getChildProperty, getChildren, getEventListenerClass, getEventType, getIntChildProperty, getResizeMode, getType, remove, removeListener, resizeChildren, setBooleanChildProperty, setBorderWidth, setChildProperty, setIntChildProperty, setResizeMode

Methods inherited from class org.gnu.gtk.Widget

activate, addAccelerator, addEvents, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, draw, drawArea, drawArea, finish, getAccessible, getAllocation, getCanFocus, getColormap, getContext, getData, getDisplay, getDragData, getEventListenerClass, getEventType, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getType, getWidget, getWindow, grabDefault, grabFocus, hasFocus, hasScreen, hide, hideAll, highlight, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeAccelerator, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setCanFocus, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setEvents, setExtensionEvents, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight, unHighlight

Methods inherited from class org.gnu.gtk.GtkObject

destroy, getType, sink

Methods inherited from class org.gnu.glib.GObject

addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify

Constructor Details

Combo

public Combo()
Construct a new Combo widget.

Combo

public Combo(Handle handle)
Construct a new Combo from a handle to a native resource.

Method Details

disableActivate

public void disableActivate()
Stops the Combo widget from showing the popup list when the Entry emits the "activate" signal, i.e., when the return key is pressed.

getEntry

public Entry getEntry()
Get the Entry field that is a part of this combo.

getText

public String getText()
Retrieve the text from the combo.

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.
Overrides:
getType in interface HBox

setCaseSensitive

public void setCaseSensitive(boolean val)
Specifies whether the text entered into the Entry field and the text in the line items are case sensitive.

This may be useful when you have called setValueInList() to limit the values entered but are not worried about case differences.


setItemString

public void setItemString(Item item,
                          String itemValue)
Sets the string to place in the Entry field when a particular item is selected. This is needed if the list item is not a simple label.
Parameters:
item - The item to add to the list.
itemValue - The string value to display in the Entry if item is selected

setPopupdownStrings

public void setPopupdownStrings(String[] values)
Convenience method to set all of the items in the popupdown list.
Parameters:
values - The array of values to put into the popupdown list.

setUseArrorwsAlways

public void setUseArrorwsAlways(boolean val)
Specifies if the arrow keys will still work even if the current contents of the Entry field do not match any of the items in the list.
Parameters:
val - true if the arrows should still work.

setUseArrows

public void setUseArrows(boolean val)
Specifies if the arrow (cursor) keys can be used to step through the items in the list. This is on by default.
Parameters:
val - true if the arrow keys can be used to step through the items in the list.

setValueInList

public void setValueInList(boolean val,
                           boolean okifEmpty)
Specifies whether the value entered in the text entry field must match one of the values in the list. If this is set then the user will not be able to perform any other action until a valid value has been entered.
Parameters:
val - true if the value entered must match one of the values in the list.
okifEmpty - true if an empty value is considered valid.