import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.UIManager; /** * */ public class CalcControl { private CalcGUI _frame = new CalcGUI(); private RPNEngine _rpnEngine = new RPNEngine(); final JFileChooser fc = new JFileChooser(); public CalcControl() { /* A few of the listeners are here as examples. You should write the rest of them. */ // listener for RollUp JTextField entry = _frame.get_tfEntry(); // listener for Save File button _frame.get_btnSaveFile().addActionListener ( new java.awt.event.ActionListener() { public void actionPerformed (ActionEvent e) { int returnVal = fc.showOpenDialog(_frame); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); PrintToFile.Singleton.printStrToFile(entry.getText(), file.getName()); } } }); // listener for Clr Stack button _frame.get_jbClrStack().addActionListener ( new java.awt.event.ActionListener() { public void actionPerformed (ActionEvent e) { _rpnEngine.clearStack(); redrawStack(); } }); _frame.setVisible(true); } // End CalcControl() /** * this function is called to update the textfields that contain * the 3 topmost elements of the stack */ private void redrawStack() { } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { } new CalcControl(); } }