I am writing my first big Scala program. In the Java equivalent, I have an enumeration that contains labels and tooltips for my user interface controls:
public enum ControlText {
CANCEL_BUTTON("Cancel", "Cancel the changes and dismiss the dialog"),
OK_BUTTON("OK", "Save the changes and dismiss the dialog"),
;
private final String controlText;
private final String toolTipText;
ControlText(String controlText, String toolTipText) {
this.controlText = controlText;
this.toolTipText = toolTipText;
}
public String getControlText() { return controlText; }
public String getToolTipText() { return toolTipText; }
}
Ignore the wisdom of using enumerations for this. There are other places that I want to do with similar things.
How to do this in Scala using scala.Enumeration? The Enumeration.Value class accepts only one row as a parameter. Do I need subclasses of it?
Thanks.
Ralph source
share