Commit ed90b112 authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Fix for big numbers in formatted text fields

parent 5cd18cb8
......@@ -35,6 +35,6 @@ public class DoubleInputField extends JFormattedTextField{
}
public double getValueAsDouble() {
return Double.parseDouble(getText());
return (double)getValue();
}
}
......@@ -22,24 +22,31 @@
package de.hhu.ba.yoshikoWrapper.gui;
import javax.swing.JFormattedTextField;
import javax.swing.text.NumberFormatter;
/**
* Provides a more strict input field that only accepts integers
*/
@SuppressWarnings("serial")
public class IntegerInputField extends JFormattedTextField{
private final NumberFormatter formatter;
public IntegerInputField(int minValue, int maxValue) {
super(FormatHelper.getIntegerFormatter(minValue,maxValue));
super();
formatter = FormatHelper.getIntegerFormatter(minValue,maxValue);
this.setFormatter(formatter);
this.setColumns(8);
}
public IntegerInputField() {
super(FormatHelper.getIntegerFormatter());
super();
formatter = FormatHelper.getIntegerFormatter();
this.setFormatter(formatter);
this.setColumns(8);
}
public int getValueAsInt() {
return Integer.parseInt(getText());
return (int) getValue();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment