Ejemplo n.º 1
0
  public void checkData() {
    if (isUpdatingData) {
      return;
    }

    if (this.op == null) {
      // System.err.println("[ERROR] OscilatorPanel::checkData() - Tried
      // to set data on null Operator");
      return;
    }

    op.freqCoarse = freqCoarse.getValue();
    op.freqFine = freqFine.getValue();
    op.detune = detune.getValue();
    op.mode = modeCombo.getSelectedIndex();
    op.sync = syncCombo.getSelectedIndex();
  }
Ejemplo n.º 2
0
  public OscilatorPanel() {
    setOscilatorLabel();

    Vector<String> items = new Vector<>(2);
    items.add("Ratio");
    items.add("Fixed (Hz)");
    modeCombo = new JComboBox(items);

    items = new Vector<>(2);
    items.add("Off");
    items.add("On");
    syncCombo = new JComboBox(items);

    JPanel modePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    modePanel.add(new JLabel("Mode "));
    modePanel.add(modeCombo);
    modePanel.add(new JLabel(" Sync (*)"));
    modePanel.add(syncCombo);

    this.setLayout(new GridLayout(5, 1));

    this.add(oscilatorLabel);
    this.add(modePanel);
    this.add(freqCoarse);
    this.add(freqFine);
    this.add(detune);

    ChangeListener cl =
        (ChangeEvent e) -> {
          checkData();
        };

    freqCoarse.addChangeListener(cl);
    freqFine.addChangeListener(cl);
    detune.addChangeListener(cl);

    ActionListener al =
        (ActionEvent ae) -> {
          checkData();
        };

    modeCombo.addActionListener(al);
    syncCombo.addActionListener(al);
  }
Ejemplo n.º 3
0
  public void editOperator(Operator op) {
    isUpdatingData = true;

    if (op == null) {
      return;
    }

    this.op = null;

    modeCombo.setSelectedIndex(op.mode);
    syncCombo.setSelectedIndex(op.sync);

    freqCoarse.setValue(op.freqCoarse);
    freqFine.setValue(op.freqFine);
    detune.setValue(op.detune);

    this.op = op;

    isUpdatingData = false;
  }