package gve.calc; import awt.*; import awt.Button; import java.awt.*; import java.awt.event.*; import gve.calc.formula.*; public class PlotWindow extends Frame implements WindowListener,ActionListener { private PlotCanvas plotcan; int number; private Layer userlayer; static private int count = 1; public PlotWindow(Formula f) { super("Plot Window #" + count); number = ++count; setSize(new Dimension(200,150)); Panel p; add("North",p = new Panel()); p.setBackground(Color.lightGray); MenuButton mb; p.add(mb = new MenuButton("Plot",this,MenuButton.DOWN)); Button b; mb.add(b = new Button("Dots")); b.addActionListener(this); mb.add(b = new Button("Connected dots")); b.addActionListener(this); mb.add(b = new Button("Intervals")); b.addActionListener(this); mb.add(b = new Button("Dismiss")); b.addActionListener(this); mb.pack(); p.add(mb = new MenuButton("Zoom",this,MenuButton.DOWN)); mb.add(b = new Button("Zoom in x10")); b.addActionListener(this); mb.add(b = new Button("Zoom in x2")); b.addActionListener(this); mb.add(b = new Button("Zoom out x2")); b.addActionListener(this); mb.add(b = new Button("Zoom out x10")); b.addActionListener(this); mb.pack(); add("Center",plotcan = new PlotCanvas(f)); setVisible(true); addWindowListener(this); } public void windowActivated(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e) { dispose(); } public void windowDeactivated(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowOpened(WindowEvent e) {} public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand(); if (cmd.equals("Dots")) { plotcan.setPlotMode(PlotCanvas.DOTS); } else if (cmd.equals("Connected dots")) { plotcan.setPlotMode(PlotCanvas.CONNECTDOTS); } else if (cmd.equals("Intervals")) { plotcan.setPlotMode(PlotCanvas.INTERVALS); } else if (cmd.equals("Dismiss")) { dispose(); } else if (cmd.equals("Zoom in x10")) { plotcan.zoom(.1); } else if (cmd.equals("Zoom in x2")) { plotcan.zoom(.5); } else if (cmd.equals("Zoom out x10")) { plotcan.zoom(10); } else if (cmd.equals("Zoom out x2")) { plotcan.zoom(2); } } }