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

  1. /*
  2.  * $Id: snap_container_test.java,v 1.11 1996/10/03 19:46:51 hudson Exp $
  3.  * $Author: hudson $
  4.  */
  5.  
  6. package sub_arctic.test;
  7.  
  8. import sub_arctic.lib.interactor;
  9. import sub_arctic.lib.interactor_applet;
  10. import sub_arctic.lib.manager;
  11. import sub_arctic.lib.top_level;
  12. import sub_arctic.lib.snap_container;
  13. import sub_arctic.lib.point_snap_target;
  14. import sub_arctic.lib.icon;
  15. import sub_arctic.lib.button;
  16. import sub_arctic.lib.oneline_text_edit;
  17. import sub_arctic.lib.base_parent_interactor;
  18. import sub_arctic.output.style_manager;
  19. import sub_arctic.output.style;
  20. import sub_arctic.output.drawable;
  21. import sub_arctic.output.loaded_image;
  22. import java.awt.Color;
  23.  
  24. public class snap_container_test extends interactor_applet {
  25.  
  26.   /**
  27.    * Shorthand for generating a button's image in the default style.
  28.    */
  29.   public static loaded_image[] std_label(String s) {
  30.     style st=style_manager.current_style();
  31.     return st.button_make_images(s,style_manager.default_font(),10,5,false);
  32.   }
  33.  
  34.   public void build_ui(base_parent_interactor top) 
  35.     {
  36.       interactor p1;
  37.       loaded_image[] lab1;
  38.  
  39.       lab1 = std_label("Snap drag me...");
  40.       p1 = new snap_container(10,10,false);
  41.       top.add_child(p1);
  42.       p1.add_child(new icon(0,0,lab1[0]));
  43.  
  44.       for (int px = 50; px < top.w(); px += 100)
  45.     for (int py = 50; py < top.h(); py += 50)
  46.       top.add_child(new target(px, py));
  47.  
  48.       top.add_child(new oneline_text_edit(315,325,200,"interference test", 
  49.                       null, true));
  50.     }
  51. }
  52.  
  53. class target extends point_snap_target {
  54.   public target(int xv, int yv) {super(xv,yv);}
  55.   public void draw_self_local(drawable d)
  56.     {
  57.       d.setColor(Color.blue);
  58.       d.fillRect(0,0,2,2);
  59.     }
  60. }
  61. /*=========================== COPYRIGHT NOTICE ===========================
  62.  
  63. This file is part of the subArctic user interface toolkit.
  64.  
  65. Copyright (c) 1996 Scott Hudson and Ian Smith
  66. All rights reserved.
  67.  
  68. The subArctic system is freely available for most uses under the terms
  69. and conditions described in 
  70.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  71. and appearing in full in the lib/interactor.java source file.
  72.  
  73. The current release and additional information about this software can be 
  74. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  75.  
  76. ========================================================================*/
  77.