home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / Bluette / Plastic / demo / ApplicationDemo.java < prev    next >
Text File  |  1997-11-13  |  9KB  |  212 lines

  1. /*
  2.  * This program was generated by PLASTIC
  3.  *
  4.  * Author : Min-Kyu Lee
  5.  * Title : RGB Color Test
  6.  * Generated Date : 97-11-14
  7.  */
  8.  
  9.  
  10. import java.awt.*;
  11.  
  12. /**
  13.  * This examples is "BLUETTE 0.62" Exmaple.
  14.  * By Hyoung-Gook Kim.
  15.  */
  16.  
  17. public class ColorTest extends Frame {
  18.         boolean fForm_Create;
  19.         Panel Panel1;
  20.         Label Label1;
  21.         Label Label2;
  22.         Label Label3;
  23.         Label RedLabel;
  24.         Label GreenLabel;
  25.         Label BlueLabel;
  26.         Scrollbar ScrollBar1;
  27.         Scrollbar ScrollBar2;
  28.         Scrollbar ScrollBar3;
  29.         ColorTest() {
  30.                 // Frame Initialization
  31.                 setForeground(Color.black);
  32.                 setBackground(Color.lightGray);
  33.                 setFont(new Font("Dialog",Font.BOLD,12));
  34.                 setTitle("ColorTest");
  35.                 setLayout(null);
  36.                 
  37.                 // Component Initialization
  38.                 Panel1 = new Panel();
  39.                 Panel1.setLayout(null);
  40.                 Panel1.setForeground(Color.black);
  41.                 Panel1.setBackground(Color.black);
  42.                 Panel1.setFont(new 
  43.                 Font("Dialog",Font.BOLD,12));
  44.                 Label1 = new Label("Red :",Label.LEFT);
  45.                 Label1.setFont(new 
  46.                 Font("Dialog",Font.BOLD,12));
  47.                 Label2 = new Label("Green :",Label.LEFT);
  48.                 Label2.setFont(new 
  49.                 Font("Dialog",Font.BOLD,12));
  50.                 Label3 = new Label("Blue :",Label.LEFT);
  51.                 Label3.setFont(new 
  52.                 Font("Dialog",Font.BOLD,12));
  53.                 RedLabel = new Label("0",Label.LEFT);
  54.                 RedLabel.setFont(new 
  55.                 Font("Dialog",Font.BOLD,12));
  56.                 GreenLabel = new Label("0",Label.LEFT);
  57.                 GreenLabel.setFont(new 
  58.                 Font("Dialog",Font.BOLD,12));
  59.                 BlueLabel = new Label("0",Label.LEFT);
  60.                 BlueLabel.setFont(new 
  61.                 Font("Dialog",Font.BOLD,12));
  62.                 ScrollBar1 = new 
  63.                 Scrollbar(Scrollbar.HORIZONTAL);
  64.                 ScrollBar1.setValues(0,22,0,255);
  65.                 ScrollBar1.setBackground(Color.lightGray);
  66.                 ScrollBar2 = new 
  67.                 Scrollbar(Scrollbar.HORIZONTAL);
  68.                 ScrollBar2.setValues(0,22,0,255);
  69.                 ScrollBar2.setBackground(Color.lightGray);
  70.                 ScrollBar3 = new 
  71.                 Scrollbar(Scrollbar.HORIZONTAL);
  72.                 ScrollBar3.setValues(0,22,0,255);
  73.                 ScrollBar3.setBackground(Color.lightGray);
  74.                 
  75.                 // Add()s
  76.                 add(ScrollBar3);
  77.                 add(ScrollBar2);
  78.                 add(ScrollBar1);
  79.                 add(BlueLabel);
  80.                 add(GreenLabel);
  81.                 add(RedLabel);
  82.                 add(Label3);
  83.                 add(Label2);
  84.                 add(Label1);
  85.                 add(Panel1);
  86.                 
  87.                 fForm_Create = true;
  88.         }
  89.         void InitialPositionSet() {
  90.                 reshape(191,107,283,229);
  91.                 Panel1.reshape(11,29,262,95);
  92.                 Label1.reshape(26,143,48,16);
  93.                 Label2.reshape(13,167,64,16);
  94.                 Label3.reshape(22,192,54,16);
  95.                 RedLabel.reshape(76,143,55,16);
  96.                 GreenLabel.reshape(77,168,50,16);
  97.                 BlueLabel.reshape(77,194,54,16);
  98.                 ScrollBar1.reshape(142,141,121,16);
  99.                 ScrollBar2.reshape(142,168,121,16);
  100.                 ScrollBar3.reshape(142,195,121,16);
  101.                 fForm_Create = false;
  102.                 
  103.                 
  104.                 
  105.                 
  106.                 
  107.         }
  108.         public boolean handleEvent(Event evt) {
  109.                 // handleEvent()
  110.                 if (evt.id == Event.WINDOW_DESTROY && 
  111.                 evt.target == this) 
  112.                 ColorTest_WindowDestroy(evt.target);
  113.                 else if (evt.id == Event.SCROLL_ABSOLUTE && 
  114.                 evt.target == ScrollBar1) 
  115.                 ScrollBar1_ScrollAbsolute(evt.target, 
  116.                 ((Scrollbar)(evt.target)).getValue());
  117.                 else if (evt.id == Event.SCROLL_LINE_DOWN && 
  118.                 evt.target == ScrollBar1) 
  119.                 ScrollBar1_ScrollAbsolute(evt.target, 
  120.                 ((Scrollbar)(evt.target)).getValue());
  121.                 else if (evt.id == Event.SCROLL_LINE_UP && 
  122.                 evt.target == ScrollBar1) 
  123.                 ScrollBar1_ScrollAbsolute(evt.target, 
  124.                 ((Scrollbar)(evt.target)).getValue());
  125.                 else if (evt.id == Event.SCROLL_PAGE_DOWN && 
  126.                 evt.target == ScrollBar1) 
  127.                 ScrollBar1_ScrollAbsolute(evt.target, 
  128.                 ((Scrollbar)(evt.target)).getValue());
  129.                 else if (evt.id == Event.SCROLL_PAGE_UP && 
  130.                 evt.target == ScrollBar1) 
  131.                 ScrollBar1_ScrollAbsolute(evt.target, 
  132.                 ((Scrollbar)(evt.target)).getValue());
  133.                 else if (evt.id == Event.SCROLL_ABSOLUTE && 
  134.                 evt.target == ScrollBar2) 
  135.                 ScrollBar2_ScrollAbsolute(evt.target, 
  136.                 ((Scrollbar)(evt.target)).getValue());
  137.                 else if (evt.id == Event.SCROLL_LINE_DOWN && 
  138.                 evt.target == ScrollBar2) 
  139.                 ScrollBar2_ScrollAbsolute(evt.target, 
  140.                 ((Scrollbar)(evt.target)).getValue());
  141.                 else if (evt.id == Event.SCROLL_LINE_UP && 
  142.                 evt.target == ScrollBar2) 
  143.                 ScrollBar2_ScrollAbsolute(evt.target, 
  144.                 ((Scrollbar)(evt.target)).getValue());
  145.                 else if (evt.id == Event.SCROLL_PAGE_DOWN && 
  146.                 evt.target == ScrollBar2) 
  147.                 ScrollBar2_ScrollAbsolute(evt.target, 
  148.                 ((Scrollbar)(evt.target)).getValue());
  149.                 else if (evt.id == Event.SCROLL_PAGE_UP && 
  150.                 evt.target == ScrollBar2) 
  151.                 ScrollBar2_ScrollAbsolute(evt.target, 
  152.                 ((Scrollbar)(evt.target)).getValue());
  153.                 else if (evt.id == Event.SCROLL_ABSOLUTE && 
  154.                 evt.target == ScrollBar3) 
  155.                 ScrollBar3_ScrollAbsolute(evt.target, 
  156.                 ((Scrollbar)(evt.target)).getValue());
  157.                 else if (evt.id == Event.SCROLL_LINE_DOWN && 
  158.                 evt.target == ScrollBar3) 
  159.                 ScrollBar3_ScrollAbsolute(evt.target, 
  160.                 ((Scrollbar)(evt.target)).getValue());
  161.                 else if (evt.id == Event.SCROLL_LINE_UP && 
  162.                 evt.target == ScrollBar3) 
  163.                 ScrollBar3_ScrollAbsolute(evt.target, 
  164.                 ((Scrollbar)(evt.target)).getValue());
  165.                 else if (evt.id == Event.SCROLL_PAGE_DOWN && 
  166.                 evt.target == ScrollBar3) 
  167.                 ScrollBar3_ScrollAbsolute(evt.target, 
  168.                 ((Scrollbar)(evt.target)).getValue());
  169.                 else if (evt.id == Event.SCROLL_PAGE_UP && 
  170.                 evt.target == ScrollBar3) 
  171.                 ScrollBar3_ScrollAbsolute(evt.target, 
  172.                 ((Scrollbar)(evt.target)).getValue());
  173.                 
  174.                 return super.handleEvent(evt);
  175.         }
  176.         public void paint(Graphics g) {
  177.                 if (fForm_Create) InitialPositionSet();
  178.         }
  179.         public static void main(String args[]) {
  180.                 ColorTest ColorTest = new ColorTest();
  181.                 ColorTest.show();
  182.         }
  183.         void ColorTest_WindowDestroy(Object target) {
  184.                 System.exit(0);
  185.         }
  186.         void ScrollBar1_ScrollAbsolute(Object target, int value) {
  187.                 RedLabel.setText(""+ScrollBar1.getValue());
  188.                 Panel1.setBackground(new 
  189.                 Color(ScrollBar1.getValue(), 
  190.                 ScrollBar2.getValue(), 
  191.                 ScrollBar3.getValue()));
  192.                 Panel1.repaint();
  193.         }
  194.         void ScrollBar2_ScrollAbsolute(Object target, int value) {
  195.                 GreenLabel.setText(""+ScrollBar2.getValue());
  196.                 Panel1.setBackground(new 
  197.                 Color(ScrollBar1.getValue(), 
  198.                 ScrollBar2.getValue(), 
  199.                 ScrollBar3.getValue()));
  200.                 Panel1.repaint();
  201.         }
  202.         void ScrollBar3_ScrollAbsolute(Object target, int value) {
  203.                 BlueLabel.setText(""+ScrollBar3.getValue());
  204.                 Panel1.setBackground(new 
  205.                 Color(ScrollBar1.getValue(), 
  206.                 ScrollBar2.getValue(), 
  207.                 ScrollBar3.getValue()));
  208.                 Panel1.repaint();
  209.         }
  210. }
  211.  
  212.