|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sub_arctic.lib.min_interactor | +--sub_arctic.lib.base_interactor | +--sub_arctic.lib.oneline_text_display | +--sub_arctic.lib.oneline_text_edit
Single line text edit box. This class allows entry and editing of a single line of text. The text is maintained with a selection or entry point. Selection positions in strings refer to the spaces before the characters (numbered from 0). So for example a selection from 0 to 0 places the cursor before the first character (the character at index 0) while a selection from 1 to 2 selects the second character (the character at index 1).
Fields inherited from class sub_arctic.lib.oneline_text_display |
_colors,
_end_of_selection,
_font,
_h_spacing,
_metric,
_start_of_selection,
_text,
_v_spacing,
_x_adjust,
BOXED,
have_focus,
NO_SELECTION,
SELECT_END |
Fields inherited from class sub_arctic.lib.base_interactor |
_child_index,
_child_list,
_clip_bounds,
_constraint_flags,
_enabled_constraint,
_flags,
_h,
_h_constraint,
_parent,
_part_a_constraint,
_part_b_constraint,
_user_data,
_visible_constraint,
_w,
_w_constraint,
_x,
_x_constraint,
_y,
_y_constraint,
default_child_hint |
Constructor Summary | |
oneline_text_edit(int xv,
int yv,
int wv,
java.lang.String init_str,
java.awt.Font fnt,
boolean boxed)
Full constructor with explicit width |
|
oneline_text_edit(int xv,
int yv,
java.lang.String init_str)
Constructor with default font and boxed status |
|
oneline_text_edit(int xv,
int yv,
java.lang.String init_str,
java.awt.Font fnt,
boolean boxed)
Full constructor where width is determined by initial string |
|
oneline_text_edit(java.lang.String init_str)
Constructor with default font and boxed status; we also assume you are going to set the x and y coordinate by other means. |
Method Summary | |
boolean |
action_char(event evt,
char ch,
java.lang.Object user_info)
Accept input for a character that has been classified as a closure action (by returning CLOSURE_ACTION_CHAR from char_filter). |
int |
char_filter(int input_char,
int modifiers)
Pre-filter a character before providing it is actually provided as input. |
int |
char_pos_of(int xpos)
Map an x position in local coordinates into a text string position. |
void |
delete_a_char()
Delete the character before the current selection (backing the selection up one character). |
boolean |
delete_char(event evt,
java.lang.Object user_info)
Accept input for a character signifying a delete. |
boolean |
drag_end(event evt,
java.lang.Object user_info)
Accept input corresponding to the end of a drag. |
boolean |
drag_feedback(event evt,
java.lang.Object user_info)
Accept a movement during a drag. |
boolean |
drag_start(event evt,
java.lang.Object user_info)
Accept the start of a drag to the object. |
boolean |
end_text_entry(event evt,
java.lang.Object user_info)
Dispatch input indicating that text input is over (e.g. |
boolean |
line_kill(event evt,
java.lang.Object user_info)
Accept input for a character signifying a line kill. |
boolean |
new_char(event evt,
char ch,
java.lang.Object user_info)
Accept input for a single character. |
boolean |
press(event evt,
java.lang.Object user_info)
Accept mouse button press input to the object. |
boolean |
release(event evt,
java.lang.Object user_info)
Companion method to press() needed to finish pressable. |
void |
replace_selection(java.lang.String with_str)
Replace the area of the current selection with the given string. |
boolean |
special_key(event evt,
int key_code,
java.lang.Object user_info)
Accept input for a key press signifying a special key (corresponding to KEY_ACTION events). |
boolean |
start_text_entry(event evt,
java.lang.Object user_info)
Accept input that signifies that object is new text focus and will receive subsequent text input. |
Methods inherited from class sub_arctic.lib.oneline_text_display |
boxed,
colors,
draw_self_local,
end_of_selection,
ensure_inside,
font,
h_spacing,
intrinsic_constraints,
set_boxed,
set_colors,
set_font,
set_h_spacing,
set_selection,
set_text,
set_v_spacing,
start_of_selection,
text,
v_spacing,
x_adjust |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public oneline_text_edit(int xv, int yv, int wv, java.lang.String init_str, java.awt.Font fnt, boolean boxed)
int
- xv x coordinate of this interactor.int
- yv y coordinate of this interactor.int
- wv width of this interactor.String
- init_str the initial string.Font
- fnt the font to use for this interactor.boolean
- boxed true if you want this interactor to have a box
around it.public oneline_text_edit(int xv, int yv, java.lang.String init_str, java.awt.Font fnt, boolean boxed)
int
- xv x coordinate of this interactor.int
- yv y coordinate of this interactor.String
- init_str the initial string.Font
- fnt the font to use for this interactor.boolean
- boxed true if you want this interactor to have a box
around it.public oneline_text_edit(int xv, int yv, java.lang.String init_str)
int
- xv x coordinate of this interactor.int
- yv y coordinate of this interactor.String
- init_str the initial string.Font
- fnt the font to use for this interactor.boolean
- boxed true if you want this interactor to have a box
around it.public oneline_text_edit(java.lang.String init_str)
int
- xv x coordinate of this interactor.int
- yv y coordinate of this interactor.String
- init_str the initial string.Font
- fnt the font to use for this interactor.boolean
- boxed true if you want this interactor to have a box
around it.Method Detail |
public void replace_selection(java.lang.String with_str)
String
- with_str the string to replace with.public void delete_a_char()
public int char_pos_of(int xpos)
int
- xpos the x position to transform (in pixels).public boolean start_text_entry(event evt, java.lang.Object user_info)
event
- evt the start of the text entry event.Object
- user_info the object passed to the agent when we went into
the focus set.public int char_filter(int input_char, int modifiers)
This routine can be used by subclasses to do a translation (e.g. to all lower case) or to filter out unwanted characters (e.g. everything except decimal digits). Filtering is done by returning the special value DISCARD_CHAR (= -1), which signifies that the character is not to be passed to new_char(). Translation is done by returning the ordinal value of the translated character. In addition, the value CLOSURE_ACTION_CHAR can be returned to indicate that the action_char() method should be invoked instead of new_char(). This is typically done for end of line characters that signify completion of an entry. All modifications to the character are considered local to this object and do not change how the character might be delivered to another object.
This routine is not called for cursor movement or other special keys (which are dispatched with special_key()), or characters classified as edit keys (e.g. to delete a character or line). The text input dispatch agent class (text_agent) provides several standard filters that can be called for common operations.
int
- input_char the char that was hit.int
- modifiers state of the modifier keys.public boolean new_char(event evt, char ch, java.lang.Object user_info)
event
- evt the input event (normally a keypress) .Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean action_char(event evt, char ch, java.lang.Object user_info)
event
- evt the input event (normally a keypress).char
- ch the action character in question.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean delete_char(event evt, java.lang.Object user_info)
event
- evt the input event (normally a keypress).Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean line_kill(event evt, java.lang.Object user_info)
event
- evt the input event (normally a keypress).Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean special_key(event evt, int key_code, java.lang.Object user_info)
event
- evt the input event (normally a key_action event).int
- key_code the special key in question.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean end_text_entry(event evt, java.lang.Object user_info)
event
- evt the input event.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean press(event evt, java.lang.Object user_info)
event
- evt the input event.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean release(event evt, java.lang.Object user_info)
event
- evt the input event.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean drag_start(event evt, java.lang.Object user_info)
event
- evt the input event.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean drag_feedback(event evt, java.lang.Object user_info)
event
- evt the input event.Object
- user_info the object passed to the agent when this object
entered the focus set.public boolean drag_end(event evt, java.lang.Object user_info)
event
- evt the input event.Object
- user_info the object passed to the agent when this
object entered the focus set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |