I want to have two textfields which will have the following validations
1) Both should be Integers
2) The value in one textfield should be a integer multiple of other
I have used two JFormattedTextFields to this. This is what i have done till now
NumberFormat updateFormat,sampleFormat;
updateFormat = NumberFormat.getNumberInstance();
updateFormat.setMaximumFractionDigits(0);
updateFormat.setParseIntegerOnly(true);
sampleFormat = NumberFormat.getNumberInstance();
sampleFormat.setMaximumFractionDigits(0);
sampleFormat.setParseIntegerOnly(true);
javax.swing.JFormattedTextField jFormattedTextField1 =new javax.swing.JFormattedTextField(updateFormat);
javax.swing.JFormattedTextField jFormattedTextField2 = new javax.swing.JFormattedTextField(sampleFormat);
With the help of this my first part is complete
Now I am stuck with the second part, i.e. jFormattedTextField1 value should be a Integer multiple of jFormattedTextField2. I think I need to customize my NumberFormat by extending it. But How should I do that? Please help me out