home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java 1.2 How-To
/
JavaHowTo.iso
/
3rdParty
/
Bluette
/
Plastic
/
demo
/
ApplicationDemo.java
< prev
next >
Wrap
Text File
|
1997-11-13
|
9KB
|
212 lines
/*
* This program was generated by PLASTIC
*
* Author : Min-Kyu Lee
* Title : RGB Color Test
* Generated Date : 97-11-14
*/
import java.awt.*;
/**
* This examples is "BLUETTE 0.62" Exmaple.
* By Hyoung-Gook Kim.
*/
public class ColorTest extends Frame {
boolean fForm_Create;
Panel Panel1;
Label Label1;
Label Label2;
Label Label3;
Label RedLabel;
Label GreenLabel;
Label BlueLabel;
Scrollbar ScrollBar1;
Scrollbar ScrollBar2;
Scrollbar ScrollBar3;
ColorTest() {
// Frame Initialization
setForeground(Color.black);
setBackground(Color.lightGray);
setFont(new Font("Dialog",Font.BOLD,12));
setTitle("ColorTest");
setLayout(null);
// Component Initialization
Panel1 = new Panel();
Panel1.setLayout(null);
Panel1.setForeground(Color.black);
Panel1.setBackground(Color.black);
Panel1.setFont(new
Font("Dialog",Font.BOLD,12));
Label1 = new Label("Red :",Label.LEFT);
Label1.setFont(new
Font("Dialog",Font.BOLD,12));
Label2 = new Label("Green :",Label.LEFT);
Label2.setFont(new
Font("Dialog",Font.BOLD,12));
Label3 = new Label("Blue :",Label.LEFT);
Label3.setFont(new
Font("Dialog",Font.BOLD,12));
RedLabel = new Label("0",Label.LEFT);
RedLabel.setFont(new
Font("Dialog",Font.BOLD,12));
GreenLabel = new Label("0",Label.LEFT);
GreenLabel.setFont(new
Font("Dialog",Font.BOLD,12));
BlueLabel = new Label("0",Label.LEFT);
BlueLabel.setFont(new
Font("Dialog",Font.BOLD,12));
ScrollBar1 = new
Scrollbar(Scrollbar.HORIZONTAL);
ScrollBar1.setValues(0,22,0,255);
ScrollBar1.setBackground(Color.lightGray);
ScrollBar2 = new
Scrollbar(Scrollbar.HORIZONTAL);
ScrollBar2.setValues(0,22,0,255);
ScrollBar2.setBackground(Color.lightGray);
ScrollBar3 = new
Scrollbar(Scrollbar.HORIZONTAL);
ScrollBar3.setValues(0,22,0,255);
ScrollBar3.setBackground(Color.lightGray);
// Add()s
add(ScrollBar3);
add(ScrollBar2);
add(ScrollBar1);
add(BlueLabel);
add(GreenLabel);
add(RedLabel);
add(Label3);
add(Label2);
add(Label1);
add(Panel1);
fForm_Create = true;
}
void InitialPositionSet() {
reshape(191,107,283,229);
Panel1.reshape(11,29,262,95);
Label1.reshape(26,143,48,16);
Label2.reshape(13,167,64,16);
Label3.reshape(22,192,54,16);
RedLabel.reshape(76,143,55,16);
GreenLabel.reshape(77,168,50,16);
BlueLabel.reshape(77,194,54,16);
ScrollBar1.reshape(142,141,121,16);
ScrollBar2.reshape(142,168,121,16);
ScrollBar3.reshape(142,195,121,16);
fForm_Create = false;
}
public boolean handleEvent(Event evt) {
// handleEvent()
if (evt.id == Event.WINDOW_DESTROY &&
evt.target == this)
ColorTest_WindowDestroy(evt.target);
else if (evt.id == Event.SCROLL_ABSOLUTE &&
evt.target == ScrollBar1)
ScrollBar1_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_LINE_DOWN &&
evt.target == ScrollBar1)
ScrollBar1_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_LINE_UP &&
evt.target == ScrollBar1)
ScrollBar1_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_PAGE_DOWN &&
evt.target == ScrollBar1)
ScrollBar1_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_PAGE_UP &&
evt.target == ScrollBar1)
ScrollBar1_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_ABSOLUTE &&
evt.target == ScrollBar2)
ScrollBar2_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_LINE_DOWN &&
evt.target == ScrollBar2)
ScrollBar2_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_LINE_UP &&
evt.target == ScrollBar2)
ScrollBar2_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_PAGE_DOWN &&
evt.target == ScrollBar2)
ScrollBar2_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_PAGE_UP &&
evt.target == ScrollBar2)
ScrollBar2_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_ABSOLUTE &&
evt.target == ScrollBar3)
ScrollBar3_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_LINE_DOWN &&
evt.target == ScrollBar3)
ScrollBar3_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_LINE_UP &&
evt.target == ScrollBar3)
ScrollBar3_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_PAGE_DOWN &&
evt.target == ScrollBar3)
ScrollBar3_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
else if (evt.id == Event.SCROLL_PAGE_UP &&
evt.target == ScrollBar3)
ScrollBar3_ScrollAbsolute(evt.target,
((Scrollbar)(evt.target)).getValue());
return super.handleEvent(evt);
}
public void paint(Graphics g) {
if (fForm_Create) InitialPositionSet();
}
public static void main(String args[]) {
ColorTest ColorTest = new ColorTest();
ColorTest.show();
}
void ColorTest_WindowDestroy(Object target) {
System.exit(0);
}
void ScrollBar1_ScrollAbsolute(Object target, int value) {
RedLabel.setText(""+ScrollBar1.getValue());
Panel1.setBackground(new
Color(ScrollBar1.getValue(),
ScrollBar2.getValue(),
ScrollBar3.getValue()));
Panel1.repaint();
}
void ScrollBar2_ScrollAbsolute(Object target, int value) {
GreenLabel.setText(""+ScrollBar2.getValue());
Panel1.setBackground(new
Color(ScrollBar1.getValue(),
ScrollBar2.getValue(),
ScrollBar3.getValue()));
Panel1.repaint();
}
void ScrollBar3_ScrollAbsolute(Object target, int value) {
BlueLabel.setText(""+ScrollBar3.getValue());
Panel1.setBackground(new
Color(ScrollBar1.getValue(),
ScrollBar2.getValue(),
ScrollBar3.getValue()));
Panel1.repaint();
}
}