import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; /** * Main program for testing Rawbutton's */ public class Main { public static void main (String [] args) { java.awt.EventQueue.invokeLater (new Runnable() { public void run() { new Main (); } }); } private ArrayList buttons = new ArrayList(); public Main () { // Window setup JFrame frame = new JFrame(); frame.setSize (500, 500); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.add (new Canvas (this)); // Create some Rawbutton's for testing buttons.add (new Rawbutton ("Push me", 100, 100)); buttons.add (new Rawbutton ("Me too", 300, 300)); // And a CircleButton buttons.add (new CircleButton ("Circle", 100, 250)); frame.setVisible (true); } /** * Catch our paint callback and pass to our "components" */ public void draw (Graphics g) { for (Rawbutton b: buttons) b.draw (g); } /** * Catch our mouse callback and call each of our "components" to * offer them the input */ public void domouse (MouseEvent event) { for (Rawbutton b: buttons) b.domouse (event.getPoint().x, event.getPoint().y); } }