Menu

#151 Text fields are too wide

gpe4gtk
closed
6
2007-03-09
2007-03-09
No

Text fields created wia DoubleTextField and DoubleTextField are too wide.

Suggested fix:

+++ clients/src/com/intel/gui/controls/DoubleTextField.java 9 Mar 2007 11:49:07
@@ -94,7 +94,7 @@
public DoubleTextField(double start, int min, int max) {

super(new DoubleDocument(min, max), new Double(start).toString(), Math.max(("" + min).length(), ("" + max)
- .length()));
+ .length()) * 2 / 3);

this.min = min;
this.max = max;
@@ -114,7 +114,7 @@
*/
public DoubleTextField(String text, double min, double max) {

- super(new DoubleDocument(min, max), text, Math.max(("" + min).length(), ("" + max).length()));
+ super(new DoubleDocument(min, max), text, Math.max(("" + min).length(), ("" + max).length()) * 2 / 3);

this.min = min;
this.max = max;
@@ -142,7 +142,7 @@
this.max = max;

// convert min and max to String by adding ""
- setColumns(Math.max(("" + min).length(), ("" + max).length()));
+ setColumns(Math.max(("" + min).length(), ("" + max).length()) * 2 / 3);
((DoubleDocument) getDocument()).setMaximum(max);
}

@@ -156,7 +156,7 @@
this.min = min;

// convert min and max to String by adding ""
- setColumns(Math.max(("" + min).length(), ("" + max).length()));
+ setColumns(Math.max(("" + min).length(), ("" + max).length()) * 2 / 3);
((DoubleDocument) getDocument()).setMinimum(min);
}

===================================================================
+++ clients/src/com/intel/gui/controls/IntTextField.java 9 Mar 2007 11:49:07
@@ -113,7 +113,7 @@
public IntTextField(int start, int min, int max) {

super(new IntDocument(min, max), new Integer(start).toString(), Math.max(("" + min).length(), ("" + max)
- .length()));
+ .length()) * 3 / 4);

this.min = min;
this.max = max;
@@ -134,7 +134,7 @@
*/
public IntTextField(String text, int min, int max) {

- super(new IntDocument(min, max), text, Math.max(("" + min).length(), ("" + max).length()));
+ super(new IntDocument(min, max), text, Math.max(("" + min).length(), ("" + max).length()) * 3 / 4);

this.min = min;
this.max = max;
@@ -164,7 +164,7 @@
this.max = max;

// convert min and max to String by adding ""
- setColumns(Math.max(("" + min).length(), ("" + max).length()));
+ setColumns(Math.max(("" + min).length(), ("" + max).length()) * 3 / 4);
((IntDocument) getDocument()).setMaximum(max);
}

@@ -178,7 +178,7 @@
this.min = min;

// convert min and max to String by adding ""
- setColumns(Math.max(("" + min).length(), ("" + max).length()));
+ setColumns(Math.max(("" + min).length(), ("" + max).length()) * 3 / 4);
((IntDocument) getDocument()).setMinimum(min);
}

Discussion

  • Nikolay Malyshev

    Logged In: YES
    user_id=1087577
    Originator: YES

    fixed and tested. All OK

     
  • Nikolay Malyshev

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB