Exemplo n.º 1
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.º 2
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));
      }
    }
  }