|
java-gnome version 4.0.19 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.Object
org.gnome.gtk.Widget
org.gnome.gtk.Container
org.gnome.gtk.Bin
org.gnome.gtk.ComboBox
org.gnome.gtk.TextComboBox
public class TextComboBox
A ComboBox for displaying simple Strings. A common use case for ComboBoxes is to just choose from
a list of textual options. This subclass of ComboBox takes care of the
mechanics of setting up a the ListStore and the appropriate CellRenderers
so as to allow a straight forward interface with a limited number of
convenience methods for adding Strings.
Usage is very straight forward:
combo = new TextComboBox(); combo.appendText("SYD"); combo.appendText("YYZ"); combo.appendText("JFK"); combo.appendText("LHR"); ...You can still use the
getActive()
from
ComboBox, but for simple lists of Strings being displayed be this Widget,
the String specific getActiveText()
that is
introduced here is probably what you want.
These text-only methods are actually found in GTK on
GtkComboBox
, but using them collides with the normal ComboBox
methods. We have therefore moved them to a custom subclass to make the API
safe.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.gnome.gtk.ComboBox |
---|
ComboBox.Changed |
Nested classes/interfaces inherited from class org.gnome.gtk.Widget |
---|
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent |
Nested classes/interfaces inherited from class org.gnome.gtk.Object |
---|
Object.Destroy |
Constructor Summary | |
---|---|
TextComboBox()
Construct a new text-only ComboBox. |
Method Summary | |
---|---|
void |
appendText(String text)
Append an item to the list. |
String |
getActiveText()
Returns the text of the active item. |
void |
insertText(int position,
String text)
Append an item at the supplied position. |
void |
prependText(String text)
Prepend an item to the beginning of the list. |
void |
removeText(int position)
Removes the item at given position from the list. |
void |
setModel(TreeModel model)
Unsupported. |
Methods inherited from class org.gnome.gtk.ComboBox |
---|
connect, getActive, getActiveIter, popdown, popup, setActive, setActiveIter |
Methods inherited from class org.gnome.gtk.Bin |
---|
getChild |
Methods inherited from class org.gnome.gtk.Container |
---|
add, getChildren, remove, setBorderWidth |
Methods inherited from class org.gnome.gtk.Widget |
---|
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll |
Methods inherited from class org.gnome.gtk.Object |
---|
connect, destroy |
Methods inherited from class org.freedesktop.bindings.Pointer |
---|
toString |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TextComboBox()
Method Detail |
---|
public void appendText(String text)
public String getActiveText()
public void insertText(int position, String text)
public void prependText(String text)
public void removeText(int position)
public void setModel(TreeModel model)
If you're using a text mode ComboBox, GTK internally allocates a ListStore of a certain structure and the methods are designed to work against it. Things will blow up if you swap it for something different, unless it had exactly the correct signature. As this signature is not something that is part of the GTK API, it is not something we're going to expose; this override is here to prevent you from shooting yourself in the foot.
setModel
in class ComboBox
UnsupportedOperationException
- if called.
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |