import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; /**This is the main routine**/ public class Main extends Applet { GridBagLayout game; GridBagConstraints c; PictureCanvas PLOT; ControlCanvas CON; ControlCanvas CON2; ColorCanvas COL; TextCanvas TEXT; Panel P1,P2,P3; public static void main(String[] args) { Main a=new Main(); Frame2 F=new Frame2("Pinwheel by Rich Schwartz",a); a.setBackground(new Color(0,0,100)); a.init(); F.add(a); F.pack(); F.addWindowListener(new WinList(F)); F.setVisible(true); } public void init() { /*****************/ Color BORDERS=new Color(0,100,200); Color BACK=Color.black; Color NAVY=new Color(0,0,100); /*****************/ game=new GridBagLayout(); c=new GridBagConstraints(); c.gridwidth=GridBagConstraints.REMAINDER; setLayout(game); setBackground(Color.black); /**list the components*/ P1=new Panel(); P2=new Panel(); P3=new Panel(); COL=new ColorCanvas(); PLOT=new PictureCanvas(); TEXT=new TextCanvas(); CON=new ControlCanvas(1); CON2=new ControlCanvas(2); /**set the component sizes**/ PLOT.setSize(700,700); TEXT.setSize(900,105); CON.setSize(95,700); CON2.setSize(95,700); COL.setSize(900,85); /**set the colors**/ PLOT.setBackground(BACK); TEXT.setBackground(new Color(100,0,100)); P1.setBackground(BORDERS); P2.setBackground(BORDERS); P3.setBackground(BORDERS); CON.setBackground(NAVY); CON2.setBackground(NAVY); /**make the layout**/ /**top layer**/ P1.add(CON2); P1.add(PLOT); P1.add(CON); /**middle*/ P2.add(COL); /**bottom layer**/ P3.add(TEXT); c.ipady=-5; game.setConstraints(P1,c); game.setConstraints(P2,c); c.ipady=0; game.setConstraints(P3,c); add(P2); add(P1); add(P3); Manager M=new Manager(); M.P=PLOT; M.T=TEXT; TEXT.M=M; M.COL=COL; PLOT.M=M; M.C=CON; M.C2=CON2; CON.M=M; CON2.M=M; COL.M=M; } public static class Frame2 extends Frame implements ComponentListener { Main a; public Frame2(String W,Main a) { super(W); this.a=a; addComponentListener(this); } public void componentHidden(ComponentEvent e) {} public void componentMoved(ComponentEvent e) {} public void componentResized(ComponentEvent e) {} public void componentShown(ComponentEvent e) {} } }