Exemplo n.º 1
0
 /** Returns the selected item in the next radio button group. */
 public String getNextRadioButton() {
   if (radioButtonGroups == null) return null;
   CheckboxGroup cg = (CheckboxGroup) (radioButtonGroups.elementAt(radioButtonIndex));
   radioButtonIndex++;
   Checkbox checkbox = cg.getSelectedCheckbox();
   String item = "null";
   if (checkbox != null) item = checkbox.getLabel();
   if (macro) {
     String label = (String) labels.get((Object) cg);
     item = Macro.getValue(macroOptions, label, item);
   }
   if (recorderOn) recordOption(cg, item);
   return item;
 }
Exemplo n.º 2
0
  public void itemStateChanged(ItemEvent e) {
    Checkbox currentCheckbox = shapeActions.getSelectedCheckbox();
    boolean CheckboxState = currentCheckbox.getState();
    String currentAction = currentCheckbox.getLabel();
    if (CheckboxState) {
      myAction = currentAction;
    } else {
      myAction = "DRAW";
    }

    applet.repaint();
  }
Exemplo n.º 3
0
  /** Récupère les preférences manquants et ferme la fenêtre */
  public void fermer() {
    // noms des joueurs
    String nom = txt_joueur0.getText();
    if (nom.compareTo("") == 0) noms[0] = "J1";
    else noms[0] = nom;
    nom = txt_joueur1.getText();
    if (nom.compareTo("") == 0) noms[1] = "J2";
    else noms[1] = nom;

    // nombre de vies
    nb_vies = new Integer(cbg_vies.getSelectedCheckbox().getLabel()).intValue();
    aleatoire = cb_aleatoire.getState();
    setVisible(false);
  } // fermer()
Exemplo n.º 4
0
 /*------------------------------------------------------------------*/
 public void itemStateChanged(ItemEvent ie) {
   if (choice.getSelectedCheckbox().getLabel().equals("Gradient Magnitude")) {
     operation = Differentials_.GRADIENT_MAGNITUDE;
   } else if (choice.getSelectedCheckbox().getLabel().equals("Gradient Direction")) {
     operation = Differentials_.GRADIENT_DIRECTION;
   } else if (choice.getSelectedCheckbox().getLabel().equals("Laplacian")) {
     operation = Differentials_.LAPLACIAN;
   } else if (choice.getSelectedCheckbox().getLabel().equals("Largest Hessian")) {
     operation = Differentials_.LARGEST_HESSIAN;
   } else if (choice.getSelectedCheckbox().getLabel().equals("Smallest Hessian")) {
     operation = Differentials_.SMALLEST_HESSIAN;
   } else if (choice.getSelectedCheckbox().getLabel().equals("Hessian Orientation")) {
     operation = Differentials_.HESSIAN_ORIENTATION;
   } else {
     cancel = true;
     operation = Differentials_.LAPLACIAN;
     IJ.error("Unexpected checkbox ID");
     this.setVisible(false);
   }
   repaint();
 } /* end itemStateChanged */
  public void read() {
    try {
      // patient.dt=""+tdt.getText();
      patient.pid = Integer.parseInt(tpid.getText());
      patient.pfnm = tpfnm.getText();
      patient.pmnm = tpmnm.getText();
      patient.plnm = tplnm.getText();
      patient.gen = cbg.getSelectedCheckbox().getLabel();

      try {
        patient.age = Integer.parseInt(tage.getText());
        tage.setText("" + patient.age);

      } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Invalid age inputed.");
        patient.age = Integer.parseInt(JOptionPane.showInputDialog("Please enter valid age:"));
        tage.setText("" + patient.age);
      }

      try {
        int wet = Integer.parseInt(twt.getText());
        twt.setText("" + wet);
      } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Invalid weight inputed.");
        int wet = Integer.parseInt(JOptionPane.showInputDialog("Please enter valid weight:"));
        twt.setText("" + wet);
      }
      patient.wt = twt.getText();
      patient.addr = tadd.getText();
      this.ad = tadd.getText();
      System.out.println(tadd.getText());

      while (true) {
        patient.cno = tcno.getText();
        if (patient.cno.length() == 10) break;
        else {
          JOptionPane.showMessageDialog(null, "Invalid Phone No.");
          patient.cno = JOptionPane.showInputDialog("Please enter valid 10-digit Phone No.:");
          tcno.setText(patient.cno);
        }
      }
      patient.dnm = tdnm.getText();
      patient.sym = tsym.getText();
      System.out.println(tsym.getText());

      patient.dig = tdig.getText();
      try {
        patient.fee = Integer.parseInt(tfee.getText());
        tfee.setText("" + patient.fee);

      } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Invalid Fee inputed.");
        patient.fee = Integer.parseInt(JOptionPane.showInputDialog("Please enter valid Fee:"));
        tfee.setText("" + patient.fee);
      }

      patient.bg = tbg.getText();
      patient.path = str;
    } catch (Exception e) {
    }
  }
Exemplo n.º 6
0
 public void itemStateChanged(ItemEvent e) {
   msg = "currnet selection ";
   msg += cbg.getSelectedCheckbox().getLabel();
   l.setText(msg);
 }
Exemplo n.º 7
0
  public void itemStateChanged(ItemEvent e) {

    // choice=MALE
    if (cbg.getSelectedCheckbox().getLabel().equals("Male")) {
      if (gross < 160000) tp.setText("0");
      else if (gross < 300000) {
        gross -= 160000;
        gross *= 0.1;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      } else if (gross < 500000) {
        gross -= 300000;
        gross *= 0.2;
        gross += 14000;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      } else {
        gross -= 500000;
        gross *= 0.3;
        gross += 54000;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      }

    }
    // choice=FEMALE
    else if (cbg.getSelectedCheckbox().getLabel().equals("Female")) {
      if (gross < 190000) tp.setText("0");
      else if (gross < 300000) {
        gross -= 190000;
        gross *= 0.1;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      } else if (gross < 500000) {
        gross -= 300000;
        gross *= 0.2;
        gross += 11000;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      } else {
        gross -= 500000;
        gross *= 0.3;
        gross += 51000;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      }
    }
    // Choice=Senior citizen
    else {
      if (gross < 240000) tp.setText("0");
      else if (gross < 300000) {
        gross -= 240000;
        gross *= 0.2;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      } else if (gross < 500000) {
        gross -= 300000;
        gross *= 0.2;
        gross += 6000;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      } else {
        gross -= 500000;
        gross *= 0.3;
        gross += 46000;
        gross += gross * 0.03;
        tp.setText(Double.toString(gross));
      }
    }
  }
Exemplo n.º 8
0
  /*------------------------------------------------------------------*/
  differentialsDialog(Frame parentWindow, String title, boolean isModal, int operation) {
    super(parentWindow, title, isModal);
    setLayout(new GridLayout(0, 1));

    Checkbox gradientMagnitude = new Checkbox("Gradient Magnitude", choice, false);
    Checkbox gradientDirection = new Checkbox("Gradient Direction", choice, false);
    Checkbox laplacian = new Checkbox("Laplacian", choice, false);
    Checkbox largestHessian = new Checkbox("Largest Hessian", choice, false);
    Checkbox smallestHessian = new Checkbox("Smallest Hessian", choice, false);
    Checkbox hessianOrientation = new Checkbox("Hessian Orientation", choice, false);
    this.operation = operation;
    switch (operation) {
      case Differentials_.GRADIENT_MAGNITUDE:
        choice.setSelectedCheckbox(gradientMagnitude);
        break;
      case Differentials_.GRADIENT_DIRECTION:
        choice.setSelectedCheckbox(gradientDirection);
        break;
      case Differentials_.LAPLACIAN:
        choice.setSelectedCheckbox(laplacian);
        break;
      case Differentials_.LARGEST_HESSIAN:
        choice.setSelectedCheckbox(largestHessian);
        break;
      case Differentials_.SMALLEST_HESSIAN:
        choice.setSelectedCheckbox(smallestHessian);
        break;
      case Differentials_.HESSIAN_ORIENTATION:
        choice.setSelectedCheckbox(hessianOrientation);
        break;
      default:
        cancel = true;
        IJ.error("Unexpected operation ID");
        setVisible(false);
    }

    gradientMagnitude.addItemListener(this);
    gradientDirection.addItemListener(this);
    laplacian.addItemListener(this);
    largestHessian.addItemListener(this);
    smallestHessian.addItemListener(this);
    hessianOrientation.addItemListener(this);

    Label separation1 = new Label("");
    Label separation2 = new Label("");
    Label separation3 = new Label("");
    Label separation4 = new Label("");

    Panel buttonPanel = new Panel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    Button cancelButton = new Button("Cancel");
    Button okButton = new Button("OK");
    cancelButton.addActionListener(this);
    okButton.addActionListener(this);
    buttonPanel.add(cancelButton);
    buttonPanel.add(okButton);

    add(separation1);
    add(gradientMagnitude);
    add(gradientDirection);
    add(separation2);
    add(laplacian);
    add(separation3);
    add(largestHessian);
    add(smallestHessian);
    add(hessianOrientation);
    add(separation4);
    add(buttonPanel);

    pack();
  } /* end differentialsDialog */