summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe>2008-01-22 20:14:49 +0000
committerBogdan Gheorghe <gheorghe>2008-01-22 20:14:49 +0000
commitcc246375a98a8488df2a06a1018b99268c8676af (patch)
treeed5a90642209cd033520f97cdb6bc97450c4da10 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
parent375026ba97901086d96423cd2f6b57bdb1d36afe (diff)
downloadeclipse.platform.swt-cc246375a98a8488df2a06a1018b99268c8676af.tar.gz
eclipse.platform.swt-cc246375a98a8488df2a06a1018b99268c8676af.tar.xz
eclipse.platform.swt-cc246375a98a8488df2a06a1018b99268c8676af.zip
216137 [Linux] DateTime does not render correctly values < 10
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index 2766aa6b53..9756f42d35 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -308,8 +308,8 @@ String getFormattedString(int style) {
int m = calendar.get(Calendar.MINUTE);
int s = calendar.get(Calendar.SECOND);
int a = calendar.get(Calendar.AM_PM);
- if ((style & SWT.SHORT) != 0) return "" + (h < 10 ? " " : "") + h + ":" + (m < 10 ? " " : "") + m + " " + ampm[a];
- return "" + (h < 10 ? " " : "") + h + ":" + (m < 10 ? " " : "") + m + ":" + (s < 10 ? " " : "") + s + " " + ampm[a];
+ if ((style & SWT.SHORT) != 0) return "" + (h < 10 ? " " : "") + h + ":" + (m < 10 ? "0" : "") + m + " " + ampm[a];
+ return "" + (h < 10 ? " " : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s + " " + ampm[a];
}
/* SWT.DATE */
int y = calendar.get(Calendar.YEAR);
@@ -807,8 +807,16 @@ void setTextField(int fieldName, int value, boolean commit, boolean adjust) {
/* Convert leading 0's into spaces. */
int prependCount = end - start - buffer.length();
for (int i = 0; i < prependCount; i++) {
- buffer.insert(0, ' ');
- }
+ switch (fieldName) {
+ case Calendar.MINUTE:
+ case Calendar.SECOND:
+ buffer.insert(0, 0);
+ break;
+ default:
+ buffer.insert(0, ' ');
+ break;
+ }
+ }
newValue = buffer.toString();
ignoreVerify = true;
text.insert(newValue);