Interfaces are a critical feature of Java, and important to get things working properly. I have many interfaces, but since they are usually very small, I’ll keep them in this document. Here are the interfaces used in my GUI classes.
| Actionable | BEditable | HasActionCommand |
public interface Actionable {
public abstract void setAsDefault();
public abstract void edit();
public abstract void newOne();
/**
* Save the current screen data to the object
* it represents.
*/
public abstract void saveElement();
/**
* Save all of the objects in the store (list).
* The exact process is determined by the store itself.
*/
public abstract void saveAll();
/**
* Retrieve the next element from the store, and
* display the data to the screen, possibly for editing.
*/
public abstract void next();
/**
* Retrieve the previous element from the store, and
* display the data to the screen, possibly for editing.
*/
public abstract void previous();
/**
* Notify the GUI to ignore any changes of the current
* element on the screen, and exit the current GUI screen.
*/
public abstract void cancel();
/**
* Allow the user to locate a specific element in the
* backing store, and display it on the screen.
*/
public abstract void find();
/**
* Remove the currently displayed element from the
* store.
*/
public abstract void remove();
/**
* Create a new element and display it on the screen,
* possibly for editing.
*/
public abstract void add();
/**
* Copy the currently displayed element into a new element, ready for
* saving or possibly editing.
*/
public abstract void copy();
/**
* Select the current element as the desired element, such as when
* selecting a league or season.
*/
public abstract Object select();
}
public interface BEditable extends HasActionCommand {
public abstract boolean hasChanged();
public abstract Object getValue();
public abstract void setValue(Object o);
public abstract void addActionListener(ActionListener al);
public abstract void setActionCommand(String s);
public abstract ActionListener[] getActionListeners();
public abstract String getActionCommand();
public abstract Object getOriginal();
public abstract void setToolTipText(String s);
public abstract void setEnabled(boolean b);
}
public interface HasActionCommand {
public abstract String getActionCommand();
}