home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / TEST / VIS_TEST.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  5.5 KB  |  139 lines

  1.  
  2. package sub_arctic.test;
  3.  
  4. /* import various pieces of the sub_arctic toolkit that we need */
  5. import sub_arctic.lib.*;
  6. import sub_arctic.input.*;
  7. import sub_arctic.constraints.std_function;
  8.  
  9.  
  10. public class vis_test extends interactor_applet 
  11.   implements callback_object {
  12.  
  13.   public base_parent_interactor par;
  14.   public interactor head;
  15.  
  16.   /* initialization of sub_arctic interface when applet starts */
  17.   public void build_ui(base_parent_interactor top) 
  18.     {
  19.       par = new base_parent_interactor(0,0);
  20.       par.set_w_constraint(std_function.eq(PARENT.W()));
  21.       par.set_h_constraint(std_function.eq(PARENT.H()));
  22.       top.add_child(par);
  23.  
  24.       toggle on_off = new toggle(10,10, this);
  25.       par.add_child(on_off);
  26.  
  27.       label c = new label("Press ");
  28.       c.set_visible_constraint(std_function.eq(PREV_SIBLING.PART_A()));
  29.       c.set_enabled_constraint(std_function.eq(PREV_SIBLING.PART_A()));
  30.       c.set_x_constraint(std_function.offset(PARENT.X(), 20));
  31.       c.set_y_constraint(std_function.centered(PARENT.H(), 0));
  32.       par.add_child(c);
  33.       head = c;
  34.  
  35.       c = new label("the");
  36.       c.set_visible_constraint(std_function.eq(PREV_SIBLING.VISIBLE()));
  37.       c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
  38.       c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
  39.       c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
  40.       par.add_child(c);
  41.  
  42.       c = new label("toggle");
  43.       c.set_visible_constraint(std_function.eq(PREV_SIBLING.VISIBLE()));
  44.       c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
  45.       c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
  46.       c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
  47.       par.add_child(c);
  48.  
  49.       c = new label("to  change  visibility...");
  50.       c.set_visible_constraint(std_function.eq(PREV_SIBLING.VISIBLE()));
  51.       c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
  52.       c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
  53.       c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
  54.       par.add_child(c);
  55.  
  56.       c = new label("   (this tests enabled too...)");
  57.       c.set_visible_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
  58.       c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
  59.       c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
  60.       c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
  61.       par.add_child(c);
  62.  
  63.       h_slider s = new h_slider(10,10, 200, 0,100, 50, 1, 10, this);
  64.       s.set_y_constraint(std_function.eq(PREV_SIBLING.Y2()));
  65.       par.add_child(s);
  66.  
  67.       c = new label("follows slider value (0..100)");
  68.       c.set_x_constraint(std_function.offset(PREV_SIBLING.PART_A(), 10));
  69.       c.set_y_constraint(std_function.offset(PREV_SIBLING.Y2(), 5));
  70.       par.add_child(c);
  71.  
  72.       v_slider s2 = new v_slider(10,10, 80, 0,150, 25, 1, 10, this);
  73.       s2.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
  74.       par.add_child(s2);
  75.  
  76.       c = new label("follows (0..150)");
  77.       c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
  78.       c.set_y_constraint(std_function.offset(PREV_SIBLING.PART_A(), 10));
  79.       par.add_child(c);
  80.  
  81.       h_scrollbar s3 = new h_scrollbar(0,0, 80, -1,3, 0, 0.25, 1,1, this);
  82.       s3.set_x_constraint(std_function.eq(PREV_SIBLING.X()));
  83.       s3.set_y_constraint(std_function.offset(PREV_SIBLING.Y2(),10));
  84.       par.add_child(s3);
  85.  
  86.       toggle t2 = new toggle(0,0,this);
  87.       t2.set_x_constraint(std_function.offset(PREV_SIBLING.X2(),10));
  88.       t2.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
  89.       t2.set_part_a_constraint(std_function.eq(PREV_SIBLING.PART_A()));
  90.       t2.set_enabled(false);
  91.       par.add_child(t2);
  92.  
  93.       h_scrollbar s4 = new h_scrollbar(10,0, 80, -10, 110, 0,0.25,1,10, this);
  94.       s4.set_y_constraint(std_function.far_edge_just(PARENT.Y2(), 5));
  95.       par.add_child(s4);
  96.  
  97.       h_scrollbar s5 = new h_scrollbar(0,0, 80, 0, 100, 0,0.25,1,10, this);
  98.       s5.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
  99.       s5.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
  100.       s5.set_part_b_constraint(std_function.eq(PREV_SIBLING.PART_A()));
  101.       par.add_child(s5);
  102.  
  103.       v_scrollbar s6 = new v_scrollbar(0,0, 80, 0, 100, 0,0.25,1,10, this);
  104.       s6.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 50));
  105.       s6.set_y_constraint(std_function.offset(PREV_SIBLING.Y(), -75));
  106.       s6.set_part_b_constraint(std_function.eq(PREV_SIBLING.PART_B()));
  107.       par.add_child(s6);
  108.  
  109.       v_scrollbar s7 = new v_scrollbar(0,0, 80, 0, 100, 0,0.25,1,10, this);
  110.       s7.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
  111.       s7.set_y_constraint(std_function.offset(PREV_SIBLING.Y(), 0));
  112.       s7.set_part_b_constraint(std_function.eq(PREV_SIBLING.PART_B()));
  113.       par.add_child(s7);
  114.     }
  115.  
  116.   /* handle callback from the button. */
  117.   public void callback(interactor from, event evt, int cb_num, Object cb_parm)
  118.     {
  119.       // now done with constraints...
  120.     }
  121. };
  122.  
  123. /*=========================== COPYRIGHT NOTICE ===========================
  124.  
  125. This file is part of the subArctic user interface toolkit.
  126.  
  127. Copyright (c) 1996 Scott Hudson and Ian Smith
  128. All rights reserved.
  129.  
  130. The subArctic system is freely available for most uses under the terms
  131. and conditions described in 
  132.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  133. and appearing in full in the lib/interactor.java source file.
  134.  
  135. The current release and additional information about this software can be 
  136. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  137.  
  138. ========================================================================*/
  139.