|
class | clickingListener |
|
class | MyDrawPanel |
|
|
void | go () |
|
Color | randomColor () |
| random returns a Color object with random values
|
|
|
static void | main (String[] args) |
|
Definition at line 5 of file changingoval.java.
◆ go()
Definition at line 38 of file changingoval.java.
38 {
39 JFrame frame = new JFrame();
40 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
41 frame.add(drawPanel);
42
43 JButton button = new JButton("Change color");
44 frame.add(button, BorderLayout.SOUTH);
45
46 frame.addMouseListener(new clickingListener());
47
48 frame.setSize(300, 300);
49 frame.setVisible(true);
50
51 while (true) {
52
53
54 Point p = frame.getMousePosition();
55 if (p != null) {
56 x = (int) p.getX();
57 y = (int) p.getY();
58 }
59 drawPanel.repaint();
60 try {
62 } catch (Exception ex) { }
63 }
64 }
Referenced by main().
◆ main()
static void changingoval.main |
( |
String[] | args | ) |
|
|
inlinestatic |
◆ randomColor()
Color changingoval.randomColor |
( |
| ) |
|
|
inline |
random returns a Color object with random values
Definition at line 7 of file changingoval.java.
7 {
8 int red = (int) (Math.random() * 255);
9 int green = (int) (Math.random() * 255);
10 int blue = (int) (Math.random() * 255);
13 }
Color randomColor()
random returns a Color object with random values
References randomColor().
Referenced by randomColor().
The documentation for this class was generated from the following file: