/** Called when a choice was made in the animation type combo box. */ public void animationCombo_actionPerformed() { int selectedIndex = animationCombo.getSelectedIndex(); switch (selectedIndex) { case HackController.DISPLAY_CHANGES: if (!partAnimMenuItem.isSelected()) partAnimMenuItem.setSelected(true); break; case HackController.ANIMATION: if (!fullAnimMenuItem.isSelected()) fullAnimMenuItem.setSelected(true); break; case HackController.NO_DISPLAY_CHANGES: if (!noAnimMenuItem.isSelected()) noAnimMenuItem.setSelected(true); break; } notifyControllerListeners(ControllerEvent.ANIMATION_MODE_CHANGE, new Integer(selectedIndex)); }
/** Called when a choice was made in the numeric format combo box. */ public void formatCombo_actionPerformed() { int selectedIndex = formatCombo.getSelectedIndex(); switch (selectedIndex) { case HackController.DECIMAL_FORMAT: if (!decMenuItem.isSelected()) decMenuItem.setSelected(true); break; case HackController.HEXA_FORMAT: if (!hexaMenuItem.isSelected()) hexaMenuItem.setSelected(true); break; case HackController.BINARY_FORMAT: if (!binMenuItem.isSelected()) binMenuItem.setSelected(true); break; } notifyControllerListeners(ControllerEvent.NUMERIC_FORMAT_CHANGE, selectedIndex); }
/** Called when a choice was made in the additional display combo box. */ public void additionalDisplayCombo_actionPerformed() { int selectedIndex = additionalDisplayCombo.getSelectedIndex(); switch (selectedIndex) { case HackController.SCRIPT_ADDITIONAL_DISPLAY: if (!scriptMenuItem.isSelected()) scriptMenuItem.setSelected(true); break; case HackController.OUTPUT_ADDITIONAL_DISPLAY: if (!outputMenuItem.isSelected()) outputMenuItem.setSelected(true); break; case HackController.COMPARISON_ADDITIONAL_DISPLAY: if (!compareMenuItem.isSelected()) compareMenuItem.setSelected(true); break; case HackController.NO_ADDITIONAL_DISPLAY: if (!noAdditionalDisplayMenuItem.isSelected()) noAdditionalDisplayMenuItem.setSelected(true); break; } notifyControllerListeners( ControllerEvent.ADDITIONAL_DISPLAY_CHANGE, new Integer(selectedIndex)); }
// Initializes this component. private void jbInit() { fileChooser.setFileFilter(new ScriptFileFilter()); this.getContentPane().setLayout(null); Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>(); JLabel slowLabel = new JLabel("Slow"); slowLabel.setFont(Utilities.thinLabelsFont); JLabel fastLabel = new JLabel("Fast"); fastLabel.setFont(Utilities.thinLabelsFont); labelTable.put(1, slowLabel); labelTable.put(5, fastLabel); speedSlider.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { SpeedSlider_stateChanged(e); } }); speedSlider.setLabelTable(labelTable); speedSlider.setMajorTickSpacing(1); speedSlider.setPaintTicks(true); speedSlider.setPaintLabels(true); speedSlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); speedSlider.setPreferredSize(new Dimension(95, 50)); speedSlider.setMinimumSize(new Dimension(95, 50)); speedSlider.setToolTipText("Speed"); speedSlider.setMaximumSize(new Dimension(95, 50)); final Dimension buttonSize = new Dimension(39, 39); loadProgramButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadProgramButton_actionPerformed(); } }); loadProgramButton.setMaximumSize(buttonSize); loadProgramButton.setMinimumSize(buttonSize); loadProgramButton.setPreferredSize(buttonSize); loadProgramButton.setSize(buttonSize); loadProgramButton.setToolTipText("Load Program"); loadProgramButton.setIcon(loadProgramIcon); ffwdButton.setMaximumSize(buttonSize); ffwdButton.setMinimumSize(buttonSize); ffwdButton.setPreferredSize(buttonSize); ffwdButton.setToolTipText("Run"); ffwdButton.setIcon(ffwdIcon); ffwdButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ffwdButton_actionPerformed(); } }); stopButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopButton_actionPerformed(); } }); stopButton.setMaximumSize(buttonSize); stopButton.setMinimumSize(buttonSize); stopButton.setPreferredSize(buttonSize); stopButton.setToolTipText("Stop"); stopButton.setIcon(stopIcon); rewindButton.setMaximumSize(buttonSize); rewindButton.setMinimumSize(buttonSize); rewindButton.setPreferredSize(buttonSize); rewindButton.setToolTipText("Reset"); rewindButton.setIcon(rewindIcon); rewindButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { rewindButton_actionPerformed(); } }); scriptButton.setMaximumSize(buttonSize); scriptButton.setMinimumSize(buttonSize); scriptButton.setPreferredSize(buttonSize); scriptButton.setToolTipText("Load Script"); scriptButton.setIcon(scriptIcon); scriptButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { scriptButton_actionPerformed(); } }); breakButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { breakButton_actionPerformed(); } }); breakButton.setMaximumSize(buttonSize); breakButton.setMinimumSize(buttonSize); breakButton.setPreferredSize(buttonSize); breakButton.setToolTipText("Open breakpoint panel"); breakButton.setIcon(breakIcon); breakpointWindow.addBreakpointListener(this); singleStepButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { singleStepButton_actionPerformed(); } }); singleStepButton.setMaximumSize(buttonSize); singleStepButton.setMinimumSize(buttonSize); singleStepButton.setPreferredSize(buttonSize); singleStepButton.setSize(buttonSize); singleStepButton.setToolTipText("Single Step"); singleStepButton.setIcon(singleStepIcon); stepOverButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stepOverButton_actionPerformed(); } }); stepOverButton.setMaximumSize(buttonSize); stepOverButton.setMinimumSize(buttonSize); stepOverButton.setPreferredSize(buttonSize); stepOverButton.setSize(buttonSize); stepOverButton.setToolTipText("Step Over"); stepOverButton.setIcon(stepOverIcon); animationCombo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { animationCombo_actionPerformed(); } }); formatCombo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { formatCombo_actionPerformed(); } }); additionalDisplayCombo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { additionalDisplayCombo_actionPerformed(); } }); messageLbl.setFont(Utilities.statusLineFont); messageLbl.setBorder(BorderFactory.createLoweredBevelBorder()); messageLbl.setBounds(new Rectangle(0, 667, CONTROLLER_WIDTH - 8, 25)); toolBar = new JToolBar(); toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT)); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); toolBar.setFloatable(false); toolBar.setLocation(0, 0); toolBar.setBorder(BorderFactory.createEtchedBorder()); arrangeToolBar(); this.getContentPane().add(toolBar, null); toolBar.revalidate(); toolBar.repaint(); repaint(); // Creating the menu bar menuBar = new JMenuBar(); arrangeMenu(); setJMenuBar(menuBar); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.getContentPane().add(messageLbl, null); setControllerSize(); // sets the frame to be visible. setVisible(true); }
/** * Sets the numeric format with the given code (out of the format constants in HackController). */ public void setNumericFormat(int formatCode) { if (!formatCombo.isSelectedIndex(formatCode)) formatCombo.setSelectedIndex(formatCode); }
public void setAdditionalDisplay(int display) { if (!additionalDisplayCombo.isSelectedIndex(display)) additionalDisplayCombo.setSelectedIndex(display); }
/** * Sets the animation mode (int code, out of the possible animation constants in HackController) */ public void setAnimationMode(int mode) { if (!animationCombo.isSelectedIndex(mode)) animationCombo.setSelectedIndex(mode); }
/** Enables the animation mode buttons. */ public void enableAnimationModes() { animationCombo.setEnabled(true); partAnimMenuItem.setEnabled(true); fullAnimMenuItem.setEnabled(true); noAnimMenuItem.setEnabled(true); }
/** Disables the animation mode buttons. */ public void disableAnimationModes() { animationCombo.setEnabled(false); partAnimMenuItem.setEnabled(false); fullAnimMenuItem.setEnabled(false); noAnimMenuItem.setEnabled(false); }
/** Called when the additional display's "no display" menu item was selected. */ public void noAdditionalDisplayMenuItem_actionPerformed() { if (!additionalDisplayCombo.isSelectedIndex(HackController.NO_ADDITIONAL_DISPLAY)) additionalDisplayCombo.setSelectedIndex(HackController.NO_ADDITIONAL_DISPLAY); }
/** Called when the additional display's "comparison" menu item was selected. */ public void compareMenuItem_actionPerformed() { if (!additionalDisplayCombo.isSelectedIndex(HackController.COMPARISON_ADDITIONAL_DISPLAY)) additionalDisplayCombo.setSelectedIndex(HackController.COMPARISON_ADDITIONAL_DISPLAY); }
/** Called when the numeric format's "binary" menu item was selected. */ public void binMenuItem_actionPerformed() { if (!formatCombo.isSelectedIndex(HackController.BINARY_FORMAT)) formatCombo.setSelectedIndex(HackController.BINARY_FORMAT); }
/** Called when the numeric format's "hexa" menu item was selected. */ public void hexaMenuItem_actionPerformed() { if (!formatCombo.isSelectedIndex(HackController.HEXA_FORMAT)) formatCombo.setSelectedIndex(HackController.HEXA_FORMAT); }
/** Called when the numeric format's "decimal" menu item was selected. */ public void decMenuItem_actionPerformed() { if (!formatCombo.isSelectedIndex(HackController.DECIMAL_FORMAT)) formatCombo.setSelectedIndex(HackController.DECIMAL_FORMAT); }
/** Called when the animation's "no animation" menu item was selected. */ public void noAnimMenuItem_actionPerformed() { if (!animationCombo.isSelectedIndex(HackController.NO_DISPLAY_CHANGES)) animationCombo.setSelectedIndex(HackController.NO_DISPLAY_CHANGES); }
/** Called when the animation's "animate" menu item was selected. */ public void fullAnimMenuItem_actionPerformed() { if (!animationCombo.isSelectedIndex(HackController.ANIMATION)) animationCombo.setSelectedIndex(HackController.ANIMATION); }