home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / Bluette / Examples / Love.java < prev    next >
Text File  |  1996-08-24  |  5KB  |  154 lines

  1. // {$R Love.JFM}
  2.  
  3. import java.awt.*;
  4. import java.applet.Applet;
  5. import java.lang.Thread;
  6.  
  7. // Class Love
  8. public class Love extends Applet
  9. {
  10.     final int MenuBarHeight = 0;
  11.  
  12.     // Component Declaration
  13.     public Image Image1;
  14.     public Label Label2;
  15.     public Label Label3;
  16.     public Label Label4;
  17.     public Label Label5;
  18.     public Label Label6;
  19.     public Label Label7;
  20.     public Label Label8;
  21.     public Label Label9;
  22.     public Panel Panel1;
  23.     public Panel Panel2;
  24.     public Label Label1;
  25.     // End of Component Declaration
  26.  
  27.     // init()
  28.     public void init()
  29.     {
  30.         // Frame Initialization
  31.         setForeground(Color.black);
  32.         setBackground(Color.white);
  33.         setFont(new Font("Dialog",Font.BOLD,12));
  34.         setLayout(null);
  35.         // End of Frame Initialization
  36.  
  37.         // Component Initialization
  38.         Image1 = getImage(getCodeBase(), "oneeye.gif");
  39.         Label2 = new Label("Could live I like one-eyed fish",Label.LEFT);
  40.         Label2.setFont(new Font("Helvetica",Font.PLAIN,12));
  41.         Label3 = new Label("Could love I like one-eyed fish",Label.LEFT);
  42.         Label3.setFont(new Font("Helvetica",Font.PLAIN,12));
  43.         Label4 = new Label("Like the ▌∩┘═ lived swimming together",Label.LEFT);
  44.         Label4.setFont(new Font("Helvetica",Font.PLAIN,12));
  45.         Label5 = new Label(" till they died to live like other two-eyed fish",Label.LEFT);
  46.         Label5.setFont(new Font("Helvetica",Font.PLAIN,12));
  47.         Label6 = new Label("Could love I ",Label.LEFT);
  48.         Label6.setFont(new Font("Helvetica",Font.PLAIN,12));
  49.         Label7 = new Label("like one-eyed ▌∩┘═ ",Label.LEFT);
  50.         Label7.setFont(new Font("Helvetica",Font.PLAIN,12));
  51.         Label8 = new Label(". . .",Label.LEFT);
  52.         Label8.setFont(new Font("Helvetica",Font.BOLD,11));
  53.         Label9 = new Label("- from <One-eyed fish's love> -",Label.LEFT);
  54.         Label9.setFont(new Font("Helvetica",Font.PLAIN,11));
  55.         Panel1 = new Panel();
  56.         Panel1.setLayout(null);
  57.         Panel1.setForeground(Color.black);
  58.         Panel1.setBackground(Color.yellow);
  59.         Panel1.setFont(new Font("Dialog",Font.BOLD,12));
  60.         Panel2 = new Panel();
  61.         Panel2.setLayout(null);
  62.         Panel2.setForeground(Color.black);
  63.         Panel2.setBackground(Color.red);
  64.         Panel2.setFont(new Font("Dialog",Font.BOLD,12));
  65.         Label1 = new Label("One-eyed fish's love",Label.LEFT);
  66.         Label1.setFont(new Font("Helvetica",Font.BOLD,12));
  67.         // End of Component Initialization
  68.  
  69.         // Add()s
  70.         Panel2.add(Label1);
  71.         Panel1.add(Panel2);
  72.         add(Panel1);
  73.         add(Label9);
  74.         add(Label8);
  75.         add(Label7);
  76.         add(Label6);
  77.         add(Label5);
  78.         add(Label4);
  79.         add(Label3);
  80.         add(Label2);
  81.         // End of Add()s
  82.  
  83.         InitialPositionSet();
  84.     } // End of init()
  85.  
  86.     // start()
  87.     public void start()
  88.     {
  89.     } // End of start()
  90.  
  91.     // stop()
  92.     public void stop()
  93.     {
  94.     } // End of stop()
  95.  
  96.     // destroy()
  97.     public void destroy()
  98.     {
  99.     } // End of destroy()
  100.  
  101.     public void paint(Graphics g)
  102.     {
  103.         // paint()
  104.         g.drawImage(Image1, 272,11,113,57, this);
  105.         // End of paint()
  106.     }
  107.  
  108.     public void InitialPositionSet()
  109.     {
  110.         // InitialPositionSet()
  111.         resize(393,245);
  112.         Label2.reshape(20,55+MenuBarHeight,211,16);
  113.         Label3.reshape(20,75+MenuBarHeight,229,16);
  114.         Label4.reshape(20,95+MenuBarHeight,276,16);
  115.         Label5.reshape(20,115+MenuBarHeight,299,16);
  116.         Label6.reshape(20,135+MenuBarHeight,88,16);
  117.         Label7.reshape(20,156+MenuBarHeight,138,16);
  118.         Label8.reshape(21,179+MenuBarHeight,35,16);
  119.         Label9.reshape(24,218+MenuBarHeight,216,18);
  120.         Panel1.reshape(10,13+MenuBarHeight,252,34);
  121.         Panel2.reshape(3,3,220,24);
  122.         Label1.reshape(4,3,180,18);
  123.         // End of InitialPositionSet()
  124.     }
  125.  
  126.     public boolean handleEvent(Event evt)
  127.     {
  128.         // handleEvent()
  129.         if (evt.id == Event.WINDOW_DESTROY && evt.target == this) Love_WindowDestroy(evt.target);
  130.         else if (evt.id == Event.MOUSE_MOVE && evt.target == this) Love_MouseMove(evt.target, evt.x, evt.y, evt.modifiers);
  131.         // End of handleEvent()
  132.  
  133.         return super.handleEvent(evt);
  134.     }
  135.  
  136.     // Event Handling Routines
  137.     public void Love_WindowDestroy(Object target)
  138.     {
  139.         System.exit(0);
  140.     }
  141.  
  142.     public void Love_MouseMove(Object target, int x, int y, int modifiers)
  143.     {
  144.         Panel1.setBackground(new Color(255,x,y));
  145.         Panel2.setBackground(new Color(255,y,x));
  146.         Panel1.repaint();
  147.         Panel2.repaint();
  148.     }
  149.  
  150.     // End of Event Handling Routines
  151.  
  152. } // End of Class Love
  153.  
  154.