This repository was archived by the owner on Jul 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGUITest.java
77 lines (70 loc) · 1.94 KB
/
GUITest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import static com.sun.java.accessibility.util.AWTEventMonitor.addWindowListener;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.concurrent.ThreadLocalRandom;
/**
*
* @author
*/
public class GUITest {
/**
* @param args the command line arguments
*/
public static Color get(int c){
switch(c){
case 1:
return Color.RED;
case 2:
return Color.BLUE;
case 3:
return Color.ORANGE;
case 4:
return Color.CYAN;
case 5:
return Color.MAGENTA;
case 6:
return Color.PINK;
case 7:
return Color.YELLOW;
case 8:
return Color.WHITE;
default:
return Color.BLACK;
}
}
public static void GUIWTF(){
// Create Object
Frame fr = new Frame("GUI Test");
// Add Closing Event handler
addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent event){
System.exit(0);
}
});
// Set Window Size
fr.setSize(400,300);
// Set Visibility
fr.setVisible(true);
for(;;){
// LSD loop
fr.setBackground(get(ThreadLocalRandom.current().nextInt(1, 8 + 1)));
}
}
public static void main(String[] args) {
// TODO code application logic here
// Start Class GUITest
GUIWTF();
// Start Class GUIPaint
for(int i=0; i<1; i++){
GUIPaint pnt = new GUIPaint();
pnt.GPaint();
}
}
}