java-gnome version 4.0.7

org.gnome.gtk
Class Entry

java.lang.Object
  extended by org.freedesktop.bindings.Proxy
      extended by org.gnome.glib.Object
          extended by org.gnome.gtk.Object
              extended by org.gnome.gtk.Widget
                  extended by org.gnome.gtk.Entry
All Implemented Interfaces:
CellEditable, Editable
Direct Known Subclasses:
SpinButton

public class Entry
extends Widget
implements Editable, CellEditable

A data entry field allowing the user to input a single line of text.

Since:
4.0.3
Author:
Sebastian Mancke, Andrew Cowie

Nested Class Summary
static interface Entry.ACTIVATE
          The activate signal occurs when the user presses <RETURN> in an Entry.
 
Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.BUTTON_PRESS_EVENT, Widget.BUTTON_RELEASE_EVENT, Widget.ENTER_NOTIFY_EVENT, Widget.EXPOSE_EVENT, Widget.FOCUS_IN_EVENT, Widget.FOCUS_OUT_EVENT, Widget.HIDE, Widget.KEY_PRESS_EVENT, Widget.KEY_RELEASE_EVENT, Widget.LEAVE_NOTIFY_EVENT, Widget.UNMAP_EVENT, Widget.VISIBILITY_NOTIFY_EVENT
 
Nested classes/interfaces inherited from interface org.gnome.gtk.Editable
Editable.CHANGED
 
Constructor Summary
Entry()
          Construct a new Entry
Entry(java.lang.String text)
          Construct a new Entry, initialized with the specified text
 
Method Summary
 void connect(Editable.CHANGED handler)
          Connect a CHANGED handler.
 void connect(Entry.ACTIVATE handler)
          Connects an Entry.ACTIVATE handler to the Widget.
 int getMaxLength()
          Returns the current maximum width, in characters, the text in the Entry is allowed to be.
 java.lang.String getText()
          Get the text currently showing in the Entry.
 boolean isVisibleChars()
          Returns the state of whether text in the Entry are visible or hidden by an obscuring character.
 void selectRegion(int start, int end)
          Select a region of the text in this Editable.
 void setAlignment(float xalign)
          Set the alignment of the the text being displayed in the Entry.
 void setEditable(boolean editable)
          Set whether the text in the Entry can be change by the user.
 void setInvisibleChar(char replacement)
          Change the character used to obscure text when setVisibleChars() is false.
 void setMaxLength(int max)
          Specify the maximum number of characters the user is allowed to enter.
 void setPosition(int position)
          Set the position of the cursor in this Editable.
 void setText(java.lang.String text)
          Replace the current contents of the Entry with the supplied text.
 void setVisibleChars(boolean visible)
          Set whether the text in the entry is visible or obscured.
 void setWidthChars(int width)
          Request that the width of this Entry be wide enough for a given number of characters.
 
Methods inherited from class org.gnome.gtk.Widget
activate, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getHasFocus, getParent, getRequisition, getToplevel, getWindow, grabFocus, hide, modifyBackground, modifyText, setCanFocus, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
 
Methods inherited from class org.freedesktop.bindings.Proxy
toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Entry

public Entry()
Construct a new Entry


Entry

public Entry(java.lang.String text)
Construct a new Entry, initialized with the specified text

Method Detail

connect

public void connect(Editable.CHANGED handler)
Connect a CHANGED handler.

Specified by:
connect in interface Editable
Since:
4.0.6

connect

public void connect(Entry.ACTIVATE handler)
Connects an Entry.ACTIVATE handler to the Widget.

Since:
4.0.3

getMaxLength

public int getMaxLength()
Returns the current maximum width, in characters, the text in the Entry is allowed to be.


getText

public java.lang.String getText()
Get the text currently showing in the Entry. This is typically the most significant method as it is the one you use to get the result of the user's activity upon receiving a ACTIVATE signal.


isVisibleChars

public boolean isVisibleChars()
Returns the state of whether text in the Entry are visible or hidden by an obscuring character.

Returns:
true if characters entered are visible, false if obscured.

selectRegion

public void selectRegion(int start,
                         int end)
Description copied from interface: Editable
Select a region of the text in this Editable. The characters between start up to but not including end will be selected.

Calling selectRegion(0, 0) will remove the selection (although that will only happen if some other Widget has the focus; in Windows where there is only one control the user can manipulate an Entry will end up selected no matter what).

Specified by:
selectRegion in interface Editable
end - If negative, then the selection will be from start to the end of the text in the Editable.

setAlignment

public void setAlignment(float xalign)
Set the alignment of the the text being displayed in the Entry.

Parameters:
xalign - A value from 0.0f for fully left-aligned through 1.0f for fully right-aligned. You can use the constants LEFT, CENTER and RIGHT in Alignment for convenience if you like. No, this has nothing to do with politics.
Since:
4.0.6

setEditable

public void setEditable(boolean editable)
Set whether the text in the Entry can be change by the user.


setInvisibleChar

public void setInvisibleChar(char replacement)
Change the character used to obscure text when setVisibleChars() is false.

Parameters:
replacement - The new character to be used to obscure text. A value of 0 will cause no feedback to displayed at all when the user is typing in the Entry.

setMaxLength

public void setMaxLength(int max)
Specify the maximum number of characters the user is allowed to enter. Note that if the current text in the Entry is longer than the specified length, the contents will be truncated!

Parameters:
max - A value of 0 indicates no maximum length.

setPosition

public void setPosition(int position)
Description copied from interface: Editable
Set the position of the cursor in this Editable. The cursor will be put before the character at the position indicated.

Specified by:
setPosition in interface Editable
Parameters:
position - The value given must be less than or equal to the number of characters currently in the Editable field. Supplying a value of -1 will cause the cursor to move to a position after the last character in the text.

setText

public void setText(java.lang.String text)
Replace the current contents of the Entry with the supplied text.


setVisibleChars

public void setVisibleChars(boolean visible)
Set whether the text in the entry is visible or obscured. This is typically used for password fields. When set to be not visible, characters entered are shown with a * instead. This default can be changed with setInvisibleChar().

Parameters:
visible - true for showing, false for hiding

setWidthChars

public void setWidthChars(int width)
Request that the width of this Entry be wide enough for a given number of characters.

As with all font related operations, there are a number of competing approximations involved. In particular, this method operates by influencing the size requested by this Widget; the box packing model will still have the final say in the size allocation phase.

See also Label's setWidthChars(); the challenges and constraints involved are similar.

Parameters:
width - A setting of -1 will return the Entry to normal sizing behaviour.
Since:
4.0.6


java-gnome