// 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);
  }
示例#2
0
  // initializes the internal component of the translator
  protected void jbInit() {
    this.getContentPane().setLayout(new GridBagLayout());

    loadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadButton_actionPerformed(e);
          }
        });
    loadButton.setMaximumSize(new Dimension(39, 39));
    loadButton.setMinimumSize(new Dimension(39, 39));
    loadButton.setPreferredSize(new Dimension(39, 39));
    loadButton.setSize(new Dimension(39, 39));
    loadButton.setToolTipText("Load Source File");
    loadButton.setIcon(loadIcon);

    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveButton_actionPerformed(e);
          }
        });
    saveButton.setMaximumSize(new Dimension(39, 39));
    saveButton.setMinimumSize(new Dimension(39, 39));
    saveButton.setPreferredSize(new Dimension(39, 39));
    saveButton.setSize(new Dimension(39, 39));
    saveButton.setToolTipText("Save Destination File");
    saveButton.setIcon(saveIcon);

    singleStepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepButton_actionPerformed(e);
          }
        });
    singleStepButton.setMaximumSize(new Dimension(39, 39));
    singleStepButton.setMinimumSize(new Dimension(39, 39));
    singleStepButton.setPreferredSize(new Dimension(39, 39));
    singleStepButton.setSize(new Dimension(39, 39));
    singleStepButton.setToolTipText("Single Step");
    singleStepButton.setIcon(singleStepIcon);

    ffwdButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdButton_actionPerformed(e);
          }
        });
    ffwdButton.setMaximumSize(new Dimension(39, 39));
    ffwdButton.setMinimumSize(new Dimension(39, 39));
    ffwdButton.setPreferredSize(new Dimension(39, 39));
    ffwdButton.setSize(new Dimension(39, 39));
    ffwdButton.setToolTipText("Fast Forward");
    ffwdButton.setIcon(ffwdIcon);

    rewindButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindButton_actionPerformed(e);
          }
        });
    rewindButton.setMaximumSize(new Dimension(39, 39));
    rewindButton.setMinimumSize(new Dimension(39, 39));
    rewindButton.setPreferredSize(new Dimension(39, 39));
    rewindButton.setSize(new Dimension(39, 39));
    rewindButton.setToolTipText("Rewind");
    rewindButton.setIcon(rewindIcon);

    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed(e);
          }
        });
    stopButton.setMaximumSize(new Dimension(39, 39));
    stopButton.setMinimumSize(new Dimension(39, 39));
    stopButton.setPreferredSize(new Dimension(39, 39));
    stopButton.setSize(new Dimension(39, 39));
    stopButton.setToolTipText("Stop");
    stopButton.setIcon(stopIcon);

    fullTranslationButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fullTranslationButton_actionPerformed(e);
          }
        });
    fullTranslationButton.setMaximumSize(new Dimension(39, 39));
    fullTranslationButton.setMinimumSize(new Dimension(39, 39));
    fullTranslationButton.setPreferredSize(new Dimension(39, 39));
    fullTranslationButton.setSize(new Dimension(39, 39));
    fullTranslationButton.setToolTipText("Fast Translation");
    fullTranslationButton.setIcon(fullTranslationIcon);

    messageLbl.setFont(Utilities.statusLineFont);
    messageLbl.setLineWrap(true);
    messageLbl.setEditable(false);
    messageLbl.setCursor(null);
    messageLbl.setOpaque(false);
    messageLbl.setFocusable(false);
    messageLblPane.setBorder(BorderFactory.createLoweredBevelBorder());
    // messageLblPane.setBounds(new Rectangle(0, 672, TRANSLATOR_WIDTH - 8, 20));
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 2;
    this.getContentPane().add(messageLblPane, c);

    // arrowLabel.setBounds(new Rectangle(290, 324, 88, 71));
    arrowLabel.setIcon(arrowIcon);

    // source.setVisibleRows(31);
    // destination.setVisibleRows(31);
    // source.setBounds(new Rectangle(35,100,source.getWidth(),source.getHeight()));
    // destination.setBounds(new Rectangle(375,100,destination.getWidth(),destination.getHeight()));

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 1;
    this.getContentPane().add(source, c);

    c.fill = GridBagConstraints.NONE;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 1;
    c.gridy = 1;
    this.getContentPane().add(arrowLabel, c);

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 2;
    c.gridy = 1;
    this.getContentPane().add(destination, c);

    // Adding the tool bar to this container.
    toolBar.setFloatable(false);
    toolBar.setLocation(0, 0);
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    arrangeToolBar();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 0;
    this.getContentPane().add(toolBar, c);
    toolBar.revalidate();
    toolBar.repaint();
    repaint();

    // Creating the menu bar
    arrangeMenu();
    setJMenuBar(menuBar);

    // initializing the window size and visibility
    setDefaultCloseOperation(3);
    setSize(new Dimension(TRANSLATOR_WIDTH, TRANSLATOR_HEIGHT));
    setVisible(true);
  }