|
|||||||||
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.contrib.simple_color_picker
simple_color_picker implements the simplest type of color choosing interactor: an array of colored buttons. By default (most of) the named colors in java.awt.Color will be used for the color buttons. You can also pass in an array of colors to be used. You can poll the interactor for the last selected color by calling last_selected_color, or you can get callbacks when a new color is selected (the callback number is COLOR_CHANGED).
Field Summary | |
protected int |
button_border
|
protected int |
button_gap
|
protected int |
button_size
|
protected button[] |
buttons
|
protected callback_object |
cbobj
|
protected java.awt.Color[] |
colors
|
protected static java.awt.Color[] |
default_colors
The default set of colors to display, if none are provided. |
protected int |
group_size
|
protected java.awt.Color |
last_color
|
static int |
LAYOUT_HORIZ
These are constants for layout. |
protected int |
layout_mode
|
static int |
LAYOUT_VERT
These are constants for layout. |
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 | |
simple_color_picker()
Simplest constructor. |
|
simple_color_picker(callback_object cbobj)
Constructor providing only the callback object. |
|
simple_color_picker(java.awt.Color[] colors)
Constructor providing only the layout mode, either LAYOUT_HORIZ or LAYOUT_VERT. |
|
simple_color_picker(java.awt.Color[] colors,
int mode,
int group_size,
callback_object cbobj)
This is the full constructor to create a new simple_color_picker. |
Method Summary | |
int |
button_border()
Return the size of the button border. |
int |
button_gap()
Retrieve the gap (spacing) between buttons. |
int |
button_size()
Retrieve the size of the buttons. |
callback_object |
callback_obj()
Return the current callback object. |
void |
callback(interactor from,
event evt,
int cbnum,
java.lang.Object ui)
Take callbacks from our component buttons and forward them to our callback object (if we have one). |
java.awt.Color[] |
colors()
Return the current color array. |
void |
do_callback(event evt,
int cbnum,
java.lang.Object ui)
|
protected void |
draw_self_local(drawable d)
|
int |
first_callback_num()
|
int |
last_callback_num()
|
java.awt.Color |
last_selected_color()
Poll the interactor for the last color selected. |
int |
layout_mode()
Retrieve the current layout mode, either LAYOUT_HORIZ or LAYOUT_VERT. |
static void |
main(java.lang.String[] argv)
A simple main() routine to test with... |
void |
set_button_border(int bb)
Set the size of the border of each button. |
void |
set_button_gap(int bg)
Set the gap (spacing) between buttons. |
void |
set_button_size(int bs)
Set the size of the color buttons. |
void |
set_callback_obj(callback_object cb)
Set a new callback object. |
void |
set_colors(java.awt.Color[] colors)
Set the current color array. |
void |
set_layout_mode(int layout_mode)
Set the layout mode to either LAYOUT_HORIZ or LAYOUT_VERT. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int LAYOUT_HORIZ
public static final int LAYOUT_VERT
protected static final java.awt.Color[] default_colors
protected java.awt.Color[] colors
protected java.awt.Color last_color
protected button[] buttons
protected int layout_mode
protected callback_object cbobj
protected int button_border
protected int button_gap
protected int button_size
protected int group_size
Constructor Detail |
public simple_color_picker()
public simple_color_picker(java.awt.Color[] colors)
public simple_color_picker(callback_object cbobj)
public simple_color_picker(java.awt.Color[] colors, int mode, int group_size, callback_object cbobj)
Color[]
- colors An array of colors to use.int
- mode Should be either LAYOUT_HORIZ or LAYOUT_VERT to
indicate whether to favor horizontal or vertical layout.int
- group_size The size of a row (if LAYOUT_HORIZ) or of a
column (if LAYOUT_VERT).callback_object
- cbobj Where to send our callbacks to.Method Detail |
public callback_object callback_obj()
public void set_callback_obj(callback_object cb)
public void set_button_size(int bs)
public int button_size()
public void set_button_border(int bb)
public int button_border()
public void set_button_gap(int bg)
public int button_gap()
public java.awt.Color[] colors()
public void set_colors(java.awt.Color[] colors)
public int layout_mode()
public void set_layout_mode(int layout_mode)
protected void draw_self_local(drawable d)
public java.awt.Color last_selected_color()
public void callback(interactor from, event evt, int cbnum, java.lang.Object ui)
public void do_callback(event evt, int cbnum, java.lang.Object ui)
public int first_callback_num()
public int last_callback_num()
public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |