Esempio n. 1
0
 /**
  * Creates the Peripherals frame.
  *
  * @param computer the computer control object
  * @param computerHardware the computer hardware object
  */
 public PeripheralsFrame(final Computer computer, final ComputerHardware computerHardware) {
   super(
       Application.getString(PeripheralsFrame.class, "peripherals.frameTitle"),
       computer.getIconLayout().getIcon(IconLayout.ICON_POSITION_CABLE));
   log.fine("New PeripheralsFrame creation started");
   assert computerHardware != null;
   peripherals =
       new Peripheral[] {
         new IOPanel(computerHardware),
         new LEDMatrix(),
         new ColorLEDMatrix(),
         new SiSDMatrix(),
         new PCKeyboard(),
         new ADC(),
         new DACAnalog(),
         new DACDigital(),
         new Counter(),
         new DebugOutput()
       };
   peripheralsPanel = new PeripheralsPanel(this, peripherals);
   add(peripheralsPanel);
   setUp();
   pack();
   log.fine("PeripheralsFrame set up");
 }
Esempio n. 2
0
 /**
  * Displays a modal Yes/No confirmation dialog box.
  *
  * @param parentComponent determines the {@code Frame} in which the dialog is displayed; if {@code
  *     null}, or if the {@code parentComponent} has no {@code Frame}, a default {@code Frame} is
  *     used
  * @param message the {@code Object} to display
  * @return an {@code int} indicating the option selected by the user
  * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless} returns {@code true}
  */
 public static int display(final Component parentComponent, final Object message)
     throws HeadlessException {
   return JOptionPane.showConfirmDialog(
       parentComponent,
       message,
       Application.getString(ConfirmationBox.class, "confirm.title"),
       JOptionPane.YES_NO_OPTION);
 }
Esempio n. 3
0
 // redraw frame
 private void redraw() {
   log.fine("PeripheralsFrame redraw started");
   super.setTitle(Application.getString(this, "peripherals.frameTitle"));
   remove(peripheralsPanel);
   peripheralsPanel = new PeripheralsPanel(this, peripherals);
   add(peripheralsPanel);
   pack();
   log.fine("PeripheralsFrame redraw completed");
 }
Esempio n. 4
0
 // redraw frame
 private void redraw() {
   log.fine("ComputerFrame redraw started");
   ComputerFrame.super.setTitle(Application.getString(this, "appName"));
   remove(computerPanel);
   computerPanel = new ComputerPanel(computer, displayHardware, keyboardHardware);
   add(computerPanel);
   pack();
   log.fine("ComputerFrame redraw completed");
 }
Esempio n. 5
0
  /**
   * Creates the Peripherals panel.
   *
   * @param frame enclosing frame
   * @param peripherals array of peripherals
   */
  public PeripheralsPanel(final CloseableFrame frame, final Peripheral[] peripherals) {
    super(new GridBagLayout());
    log.fine("New PeripheralsPanel creation started");
    this.frame = frame;
    this.peripherals = peripherals;
    peripheralCheckBoxes = new JCheckBox[peripherals.length];

    final GridBagConstraints[] peripheralCheckBoxConstraints =
        new GridBagConstraints[peripherals.length];

    setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8));

    for (int i = 0; i < peripherals.length; i++) {
      peripheralCheckBoxConstraints[i] = new GridBagConstraints();
      peripheralCheckBoxes[i] = new JCheckBox(peripherals[i].getLabelText());
      peripheralCheckBoxConstraints[i].gridx = 0;
      peripheralCheckBoxConstraints[i].gridy = i;
      peripheralCheckBoxConstraints[i].anchor = GridBagConstraints.LINE_START;
      peripheralCheckBoxConstraints[i].weightx = 0.0;
      peripheralCheckBoxConstraints[i].weighty = 0.0;
      add(peripheralCheckBoxes[i], peripheralCheckBoxConstraints[i]);
    }

    final GridBagConstraints buttonsConstraints = new GridBagConstraints();
    final JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    buttonsConstraints.gridx = 0;
    buttonsConstraints.gridy = peripherals.length;
    buttonsConstraints.anchor = GridBagConstraints.LAST_LINE_END;
    buttonsConstraints.weightx = 0.0;
    buttonsConstraints.weighty = 1.0;
    final JButton okButton = new JButton(Application.getString(this, "button.ok"));
    frame.getRootPane().setDefaultButton(okButton);
    okButton.addActionListener(new OKListener());
    buttonsPanel.add(okButton);
    final JButton cancelButton = new JButton(Application.getString(this, "button.cancel"));
    cancelButton.addActionListener(new CloseListener());
    buttonsPanel.add(cancelButton);
    add(buttonsPanel, buttonsConstraints);

    log.fine("Peripherals panel set up");
  }
Esempio n. 6
0
 /**
  * Creates the main computer control panel frame.
  *
  * @param computer the computer control object
  * @param displayHardware the display hardware to operate on
  * @param keyboardHardware the keyboard hardware to operate on
  */
 public ComputerFrame(
     final Computer computer,
     final DisplayHardware displayHardware,
     final KeyboardHardware keyboardHardware) {
   super(Application.getString(ComputerFrame.class, "appName"));
   log.fine("New ComputerFrame creation started");
   assert computer != null;
   assert displayHardware != null;
   assert keyboardHardware != null;
   this.computer = computer;
   this.displayHardware = displayHardware;
   this.keyboardHardware = keyboardHardware;
   log.finer("Application icons set up");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   computerPanel = new ComputerPanel(computer, displayHardware, keyboardHardware);
   add(computerPanel);
   pack();
   setLocationRelativeTo(null);
   Application.addLocalized(this);
   GUI.addResizeable(this);
   GUI.setApplicationIcons(this);
   setVisible(true);
   log.fine("ComputerFrame set up and displayed");
 }
Esempio n. 7
0
 /** Deactivates (blanks) the debugger display. */
 public void deactivate() {
   memoryAddress.setBlank();
   for (SiSDBlock block : memoryData) {
     block.setBlank();
   }
   registerA.setBlank();
   registerBC.setBlank();
   registerDE.setBlank();
   registerHL.setBlank();
   registerSP.setBlank();
   ledS.setState(false);
   ledZ.setState(false);
   ledAC.setState(false);
   ledP.setState(false);
   ledCY.setState(false);
   ledIE.setState(false);
   for (SiSDBlock block : breakpoints) {
     block.setBlank();
   }
   programCounter.setBlank();
   instructionDisplay.setState(Application.getString(this, "running"));
   log.fine("Debugger display deactivated");
 }