Ejemplo n.º 1
0
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (SET.equals(cmd)) {
      Prefs.setCurvatureScalingFactor(Double.parseDouble(jtCurv.getText()));
      Prefs.setSpeedScalingFactor(Double.parseDouble(jtSpeed.getText()));
      int index = jcSegScheme.getSelectedIndex();

      if (index == 0) {
        Prefs.setSegScheme(1);
      } else if (index == 1) {
        Prefs.setSegScheme(3);
      } else {
        Prefs.setSegScheme(4);
      }
      setModal(false);
      this.setVisible(false);
    }
  }
Ejemplo n.º 2
0
  public JPanel createPanel() {

    jtMain.setText("Please enter positive integer values");
    jtMain.setSize(300, 15);
    jtMain.setLocation(250, 120);
    jtMain.setBackground(Color.lightGray);

    jlCurv.setText("Curvature Scaling Factor");
    jlCurv.setSize(200, 30);
    jlCurv.setLocation(200, 200);

    jtCurv.setSize(50, 20);
    jtCurv.setLocation(450, 205);
    jtCurv.setText(Double.toString(Prefs.getCurvatureScalingFactor()));
    addWindowListener(
        new WindowAdapter() {
          public void windowOpened(WindowEvent e) {
            jtCurv.requestFocus();
          }
        });

    jlSpeed.setText("Speed Scaling Factor");
    jlSpeed.setSize(200, 30);
    jlSpeed.setLocation(200, 250);

    jtSpeed.setSize(50, 20);
    jtSpeed.setLocation(450, 255);
    jtSpeed.setText(Double.toString(Prefs.getSpeedScalingFactor()));
    jlSegScheme.setText("Segmentation Scheme");
    jlSegScheme.setSize(200, 30);
    jlSegScheme.setLocation(200, 300);

    jcSegScheme.setSize(150, 20);
    jcSegScheme.setLocation(450, 305);

    int index = 0;
    int segSchemeIndex = Prefs.getSegScheme();
    if (segSchemeIndex == 3) {
      index = 1;
    } else if (segSchemeIndex == 4) {
      index = 2;
    }

    jcSegScheme.setSelectedIndex(index);

    JButton jbSet = new JButton();
    jbSet.setLocation(275, 450);
    jbSet.setText("Set Values");
    jbSet.setSize(150, 30);
    jbSet.setActionCommand("set");
    jbSet.addActionListener(this);
    this.setBackground(Color.WHITE);

    panel.add(jtMain);
    panel.add(jlCurv);
    panel.add(jlSpeed);
    panel.add(jtCurv);
    panel.add(jtSpeed);
    panel.add(jbSet);
    panel.add(jlSegScheme);
    panel.add(jcSegScheme);
    return panel;
  }