sub_arctic.lib
Class label

java.lang.Object
  |
  +--sub_arctic.lib.min_interactor
        |
        +--sub_arctic.lib.base_interactor
              |
              +--sub_arctic.lib.oneline_text_display
                    |
                    +--sub_arctic.lib.label
Direct Known Subclasses:
int_label, multilist_title, press_label, sliding_text, text_list_element

public class label
extends oneline_text_display

This is a class which draws a string on the screen. This object has options for putting a box around the label, making it be opaque, setting its colors, and of course controlling the displayed string.


Field Summary
protected  int _above_spacing
          This stores the above spacing of the interactor.
protected  boolean _autosize
          This is the storage for the autosize variable.
protected  int _below_spacing
          This stores the below spacing of the interactor.
protected  color_pair _draw_colors
          Color pair that we draw with.
protected  boolean _opaque
          Are we drawing an opaque background?
 
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
label(int x, int y, java.lang.String s)
          Make a label using some simple defaults.
label(java.lang.String s)
          Make a label using some simple defaults.
label(java.lang.String s, java.awt.Font f)
          Make a label with some defaults.
label(java.lang.String s, int width)
          Make a label with some defaults.
label(java.lang.String s, int width, java.awt.Font f)
          Make a label with some defaults.
 
Method Summary
 int above_spacing()
          Get the spacing above the text of this interactor.
 boolean autosize()
          Retrieve the current state of autosize.
 int below_spacing()
          Get the spacing below the text of this interactor.
 void calculate_size()
          When this object changes its spacing attributes, we may need recalculate its intrinsic size.
 color_pair draw_colors()
          Retrieve the color pair that we draw with.
protected  void draw_self_local(drawable d)
          Draw the display
 int intrinsic_constraints()
          We override the intrinsic constraint function because sometimes we have intrinsic constraints (when autosize is on) and sometimes we don't.
 java.awt.Dimension natural_size()
          This function computes the natural size of a label.
 boolean opaque()
          Are we drawing an opaque background?
 void set_above_spacing(int as)
           
 void set_autosize(boolean a)
          Set the current state of the autosize variable.
 void set_below_spacing(int bs)
           
 void set_draw_colors(color_pair c)
          Set the color pair that we draw with.
 void set_font(java.awt.Font fnt)
          We override the implementation of set_font() for this object and reset the width.
 void set_intrinsic_h(int h)
          We have to override this to avoid getting a problem when the superclass tries to set the intrinsic height.
 void set_opaque(boolean v)
          Set whether we are drawing an opaque background.
 void set_text(java.lang.String t)
          We override the implementation of set_text() for this object and reset the width.
 
Methods inherited from class sub_arctic.lib.oneline_text_display
boxed, colors, end_of_selection, ensure_inside, font, h_spacing, set_boxed, set_colors, set_h_spacing, set_selection, set_v_spacing, start_of_selection, text, v_spacing, x_adjust
 
Methods inherited from class sub_arctic.lib.base_interactor
active_constraints, add_child, add_user_datum, attach_dependent, bound, callback_obj, child_index, child, clear_child_list, clear_constraint_flag_bit, clear_flag_bit, configure, constraint_flag_is_set, constraint_flag_string, constraint_on, custom_fun1, custom_fun2, damage_fixed, damage_from_child, damage_self, damage_self, damage_self, damage_self, damage_self, detach_dependent, do_action, do_action, do_callback, do_callback, drag_feature_point, draw_children, draw_self, enabled_constraint, enabled, enter_local_coordinates, eval_enabled, eval_h, eval_part_a, eval_part_b, eval_visible, eval_w, eval_x, eval_y, eval, exit_local_coords, feature_point_enabled, feature_point, filter_pt, find_child, first_callback_num, fixed_children, flag_is_set, flag_string, focus_set_enter, focus_set_exit, get_awt_component, get_external_constraint, get_part, get_top_level, get_value, global_to_local, global_to_local, h_constraint, h, handle_cycle, inform_ood, insert_child, inside_bounds, into_local, into_local, into_parent, into_parent, is_constrained, last_callback_num, local_to_global, local_to_global, mark_all_ood, mark_enabled_ood, mark_h_ood, mark_ood, mark_part_a_ood, mark_part_b_ood, mark_reparented_ood, mark_visible_ood, mark_w_ood, mark_x_ood, mark_y_ood, marked_ood, move_child_downward, move_child_downward, move_child_to_bottom, move_child_to_bottom, move_child_to_top, move_child_to_top, move_child_upward, move_child_upward, move_downward, move_to_bottom, move_to_top, move_upward, new_look_configure, next_sibling, num_actions, num_children, num_feature_points, ood_inform_all, parent, part_a_constraint, part_a, part_b_constraint, part_b, pick_within_children, pick, picked_by, pos, prev_sibling, register_resource_names, remove_child, remove_child, remove_user_datum, restyle_look_resources, restyle, set_callback_obj, set_child_index, set_child, set_constraint_flag_bit, set_constraint_flag_bit, set_constraint, set_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled, set_flag_bit, set_flag_bit, set_h_constraint, set_h_constraint, set_h_constraint, set_h, set_intrinsic_size, set_intrinsic_w, set_parent, set_part_a_constraint, set_part_a_constraint, set_part_a_constraint, set_part_a, set_part_b_constraint, set_part_b_constraint, set_part_b_constraint, set_part_b, set_pos, set_pos, set_raw_enabled, set_raw_h, set_raw_part_a, set_raw_part_b, set_raw_visible, set_raw_w, set_raw_x, set_raw_y, set_size, set_style_lock, set_user_info, set_visible_constraint, set_visible_constraint, set_visible_constraint, set_visible, set_w_constraint, set_w_constraint, set_w_constraint, set_w, set_x_constraint, set_x_constraint, set_x_constraint, set_x, set_y_constraint, set_y_constraint, set_y_constraint, set_y, setup_for_children, setup_for_children, setup_for_fixed_children, size, style_change_local, style_change, supports_children, tag_str, toString, traverse_and_collect_children, traverse_and_collect_parent, traverse_and_collect, trivial_reject, trivial_reject, user_data, user_info, value_ood, visible_constraint, visible, w_constraint, w, x_constraint, x_into_local, x_into_parent, x, y_constraint, y_into_local, y_into_parent, y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_opaque

protected boolean _opaque
Are we drawing an opaque background?

_above_spacing

protected int _above_spacing
This stores the above spacing of the interactor. By default it is three pixels, just like online_text_display.

_below_spacing

protected int _below_spacing
This stores the below spacing of the interactor. By default it is three pixels, just like online_text_display.

_draw_colors

protected color_pair _draw_colors
Color pair that we draw with.

_autosize

protected boolean _autosize
This is the storage for the autosize variable.
Constructor Detail

label

public label(int x,
             int y,
             java.lang.String s)
Make a label using some simple defaults. It doesn't try to position itself. It assumes you'll do this with constraints. It sizes by the size of the text.
Parameters:
int - x x position of the label
int - y y position of the label
String - s the string to put in the label

label

public label(java.lang.String s)
Make a label using some simple defaults. It doesn't try to position itself. It assumes you'll do this with constraints. It sizes by the size of the text.
Parameters:
String - s the string to put in the label

label

public label(java.lang.String s,
             int width)
Make a label with some defaults. This time you supply the width. Assumes x and y will use constraints.
Parameters:
String - s the string to display
int - width the width of the displayable area in pixels

label

public label(java.lang.String s,
             int width,
             java.awt.Font f)
Make a label with some defaults. This time you supply the width & a font. Assumes x and y will use constraints.
Parameters:
String - s the displayed string
int - width the number of pixels wide the display area is
Font - f the font render the string in

label

public label(java.lang.String s,
             java.awt.Font f)
Make a label with some defaults. This time you supply the font. Assumes x and y will use constraints.
Parameters:
String - s the displayed string
Font - f the font to use for rendering the string
Method Detail

opaque

public boolean opaque()
Are we drawing an opaque background?
Returns:
boolean true if the background is cleared before drawing

set_opaque

public void set_opaque(boolean v)
Set whether we are drawing an opaque background.
Parameters:
boolean - v the new opacity truth

above_spacing

public int above_spacing()
Get the spacing above the text of this interactor. Since this interactor has above and below spacing, the v_spacing attribute of its superclass is ignored.
Returns:
int the number of pixels above this interactor

set_above_spacing

public void set_above_spacing(int as)

below_spacing

public int below_spacing()
Get the spacing below the text of this interactor. Since this interactor has above and below spacing, the v_spacing attribute of its superclass is ignored.
Returns:
int the number of pixels below this interactor

set_below_spacing

public void set_below_spacing(int bs)

calculate_size

public void calculate_size()
When this object changes its spacing attributes, we may need recalculate its intrinsic size. This routine does that.

set_font

public void set_font(java.awt.Font fnt)
We override the implementation of set_font() for this object and reset the width.
Parameters:
Font - fnt the font to use for display
Overrides:
set_font in class oneline_text_display

draw_colors

public color_pair draw_colors()
Retrieve the color pair that we draw with.
Returns:
color_pair the current color pair we are using

set_draw_colors

public void set_draw_colors(color_pair c)
Set the color pair that we draw with.
Parameters:
color_pair - c the new color pair to use

draw_self_local

protected void draw_self_local(drawable d)
Draw the display
Parameters:
drawable - d the drawable on which to do the display
Overrides:
draw_self_local in class oneline_text_display

set_text

public void set_text(java.lang.String t)
We override the implementation of set_text() for this object and reset the width. The reason we override this is because the parent class oneline_text_display doesn't want to resize every time its text changes... that would be distracting. Label's however do want to resize every time.
Parameters:
String - t the string that is being displayed
Overrides:
set_text in class oneline_text_display

autosize

public boolean autosize()
Retrieve the current state of autosize.
Returns:
boolean true if the object is autosized (and thus not resizable)

set_autosize

public void set_autosize(boolean a)
Set the current state of the autosize variable. If you change the state from non-autosized (false) to autosized (true) the label will immediately autosize itself. If you change the state to non-autosized from autosized, no immediate redraw is requested and the object will continue at its current size unless that is changed.

intrinsic_constraints

public int intrinsic_constraints()
We override the intrinsic constraint function because sometimes we have intrinsic constraints (when autosize is on) and sometimes we don't.
Returns:
int a constant representing what (if any) our intrinsic constraints are.
Overrides:
intrinsic_constraints in class oneline_text_display

natural_size

public java.awt.Dimension natural_size()
This function computes the natural size of a label. This is useful when you want to walk down a list (or more likely, column) of labels and find out which of them has the largest natural size and then set all of them to that size.
Returns:
Dimension the size (in pixels) of this button at its natural size

set_intrinsic_h

public void set_intrinsic_h(int h)
We have to override this to avoid getting a problem when the superclass tries to set the intrinsic height. We don't bother setting the intrinsic height when we are not autosized.
Parameters:
int - h the new intrinsic height
Overrides:
set_intrinsic_h in class base_interactor