sol7 - 1.124J Foundations of Software Engineering Problem...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1.124J Foundations of Software Engineering Problem Set 7 - Solution Due Date: Thursday 11/2/00 Problem 1:[100%] PoleSimulator.java import javax.swing.*; import java.awt.*; import java.applet.Applet; import java.awt.event.*; import java.text.*; import java.awt.geom.CubicCurve2D; import java.net.*; import java.io.*; import java.util.*; public class PoleSimulator extends JFrame implements Runnable, ActionListener { int frameNumber; long startTime ; int delay; Thread animatorThread; boolean frozen = true; int dx=500, dy=500; boolean dataFlag=false; JMenuBar menuBar ; JMenu fileMenu; JMenuItem importMI, exitMI; JToolBar toolBar;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
JButton startButton, stopButton, continueButton, resetButton ; JSeparator separator1, separator2, separator3; PolePanel polePanel; JPanel contentPane; PoleData poleData; public PoleSimulator(String str) { super(str); poleData = new PoleData(); contentPane = new JPanel() ; contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); setMenuBar(); setToolBar(); setPolePanel(); setContentPane(contentPane); pack(); setVisible(true); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); System.exit(0); } } ); } private void setMenuBar() {
Background image of page 2
menuBar = new JMenuBar(); fileMenu = new JMenu("File"); menuBar.add(fileMenu); importMI = new JMenuItem("Import Data"); importMI.addActionListener(this); fileMenu.add(importMI); exitMI = new JMenuItem("Exit"); exitMI.addActionListener(this); fileMenu.add(exitMI); setJMenuBar(menuBar); } private void setToolBar() { toolBar = new JToolBar(); startButton = new JButton(new ImageIcon("start.gif")); startButton.setMnemonic(KeyEvent.VK_S); startButton.setToolTipText("Start"); startButton.setActionCommand("Start"); startButton.addActionListener(this); startButton.setEnabled(false); startButton.setBackground(Color.gray); toolBar.add(startButton); separator1 = new JSeparator(); separator1.setBackground(Color.black); toolBar.add(separator1); stopButton = new JButton(new ImageIcon("stop.gif")); stopButton.setMnemonic(KeyEvent.VK_B); stopButton.setToolTipText("Stop"); stopButton.setActionCommand("Stop"); stopButton.addActionListener(this); stopButton.setEnabled(false); stopButton.setBackground(Color.gray); toolBar.add(stopButton); separator2 = new JSeparator(); separator2.setBackground(Color.black);
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
toolBar.add(separator2); continueButton = new JButton(new ImageIcon("continue.gif"));
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/04/2011 for the course ESD 1.124 taught by Professor Kevinamaratunga during the Fall '00 term at MIT.

Page1 / 13

sol7 - 1.124J Foundations of Software Engineering Problem...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online