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); } }
public void actionPerformed(ActionEvent event) { parser.setString(textcomponent.getText()); }
AController(AParser aparser, TextComponentInterface thetextcomponent) { parser = aparser; textcomponent = thetextcomponent; textcomponent.addActionListener(this); }