public void propertyChange(PropertyChangeEvent event) {
   String propertyName = event.getPropertyName();
   Double newValue = (Double) event.getNewValue();
   if (propertyName.equalsIgnoreCase("height")) {
     heightField.setText(newValue.toString());
   } else if (propertyName.equalsIgnoreCase("weight")) {
     weightField.setText(event.getNewValue().toString());
   } else if (propertyName.equalsIgnoreCase("bmi")) {
     double newBMI = newValue;
     bmiSlider.setValue((int) newBMI);
     bmiProgressBar.setValue((int) newBMI);
   }
 }
示例#2
0
 public void actionPerformed(ActionEvent event) {
   parser.setString(textcomponent.getText());
 }
示例#3
0
 AController(AParser aparser, TextComponentInterface thetextcomponent) {
   parser = aparser;
   textcomponent = thetextcomponent;
   textcomponent.addActionListener(this);
 }