The ActionListener interface only has the actionPerformed method, so what you're trying to accomplish may be implemented by creating your own listener interface and having your Foo class notify the registered listeners.
For example, a new interface called PercentChangeListener could be created:
interface PercentChangeListener {
public void percentChanged();
}
Then, the Foo class can have ways to register the PercentChangeListeners which should be notified when the percentage changes:
class Foo {
// Percentage.
private Percent percent;
// Listeners which should be notified of a change to the percentage.
private List<PercentageChangeListener> listeners;
// Adds a listener that should be notified.
public void addListener(PercentageChangeListener listener) {
listener.add(listener);
}
// Notifies all the listeners which should be told that the percentage
// has changed.
private void notifyListeners() {
for (PercentageChangeListener listener : listeners) {
listener.percentChanged();
}
}
// Some process which changes the percentage.
private void someProcess() {
percent.change();
notifyListeners();
}
}
Then, any object which should be notified of a change in the percentage of Foo should implement PercentChangeListener or have an handler to handle it:
class ClassThatHandlesFoo {
public void someMethod() {
Foo f = new Foo();
f.addPercentageChangeListener(this);
}
public void percentChanged() {
// Perform action when percent of "Foo f" has changed.
}
}
The above is untested code, but should give an idea on the approach which could be taken.