home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
InternationalClockDisplayStyleEditor.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
2KB
|
76 lines
package borland.samples.intl.beans;
import java.text.*;
public class InternationalClockDisplayStyleEditor
extends java.beans.PropertyEditorSupport {
int style;
public String[] getTags() {
String result[] = {
"DEFAULT",
"SHORT",
"MEDIUM",
"LONG",
"FULL",
};
return result;
}
public String getJavaInitializationString() {
switch (style) {
case DateFormat.SHORT:
return "java.text.DateFormat.SHORT";
case DateFormat.MEDIUM:
return "java.text.DateFormat.MEDIUM";
case DateFormat.LONG:
return "java.text.DateFormat.LONG";
case DateFormat.FULL:
return "java.text.DateFormat.FULL";
default:
return "java.text.DateFormat.DEFAULT";
}
}
public void setAsText(String text) {
if (text.equals("SHORT")) {
style = DateFormat.SHORT;
} else if (text.equals("MEDIUM")) {
style = DateFormat.MEDIUM;
} else if (text.equals("LONG")) {
style = DateFormat.LONG;
} else if (text.equals("FULL")) {
style = DateFormat.FULL;
} else {
style = DateFormat.DEFAULT;
}
}
public String getAsText() {
switch (style) {
case DateFormat.SHORT:
return "SHORT";
case DateFormat.MEDIUM:
return "MEDIUM";
case DateFormat.LONG:
return "LONG";
case DateFormat.FULL:
return "FULL";
default:
return "DEFAULT";
}
}
public void setValue(Object o) {
style = ((Integer) o).intValue();
firePropertyChange();
}
public Object getValue() {
return new Integer(style);
}
}