home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / solaris2 / jdk / src / java / awt / test / insettes.jav < prev    next >
Encoding:
Text File  |  1995-10-30  |  2.2 KB  |  95 lines

  1. /*
  2.  * @(#)InsetTest.java    1.3 95/10/13 Sami Shaio
  3.  *
  4.  * Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19. import java.awt.*;
  20.      
  21. class QFrame extends Frame {
  22.     public QFrame(String t) {
  23.     super(t);
  24.     }
  25.  
  26.     public boolean handleEvent(Event e) {
  27.     if (e.id == Event.WINDOW_DESTROY) {
  28.         System.exit(0);
  29.     }
  30.     return true;
  31.     }
  32. }
  33.  
  34. public class InsetTest {
  35.     public static void main(String args[]) {
  36.     MenuBar m2;
  37.  
  38.     int d = 100;
  39.     Frame f1 = new QFrame("f1");
  40.     Frame f2 = new QFrame("f2");
  41.     Frame f3 = new QFrame("f3");
  42.     Frame f4 = new QFrame("f4");
  43.  
  44.     m2 = new MenuBar();
  45.     m2.add(new Menu("File"));
  46.     f2.setMenuBar(m2);
  47.     f1.reshape(0, 0, d, d);
  48.     f2.reshape(d, 0, d, d);
  49.     f3.reshape(0, d, d, d);
  50.     f4.reshape(d, d, d, d);
  51.  
  52.     Dialog d1 = new Dialog(f1, "d1", false);
  53.     Dialog d2 = new Dialog(f2, "d2", false);
  54.     Dialog d3 = new Dialog(f3, "d3", false);
  55.     Dialog d4 = new Dialog(f4, "d4", false);
  56.     
  57.     d1.reshape(4*d, 0, d, d);
  58.     d2.reshape(5*d, 0, d, d);
  59.     d3.reshape(4*d, d, d, d);
  60.     d4.reshape(5*d, d, d, d);
  61.  
  62.     Window w1 = new Window(f1);
  63.     Window w2 = new Window(f2);
  64.     Window w3 = new Window(f3);
  65.     Window w4 = new Window(f4);
  66.  
  67.     w1.reshape(2*d, 0, d, d);
  68.     w1.setBackground(Color.white);
  69.     w2.reshape(3*d, 0, d, d);
  70.     w2.setBackground(Color.red);
  71.     w3.reshape(2*d, d, d, d);
  72.     w3.setBackground(Color.green);
  73.     w4.reshape(3*d, d, d, d);
  74.     w4.setBackground(Color.blue);
  75.  
  76.     f1.show();
  77.     f2.show();
  78.     f3.show();
  79.     f4.show();
  80.  
  81.     d1.show();
  82.     d2.show();
  83.     d3.show();
  84.     d4.show();
  85.  
  86.     w1.show();
  87.     w2.show();
  88.     w3.show();
  89.     w4.show();
  90.     }
  91. }
  92.  
  93.            
  94.     
  95.