Reputation: 1
I have try many thing available on the internet but do not find the suitable one
Upvotes: 0
Views: 74
Reputation: 168815
..float value..
Immediately suggests a JSpinner
with an appropriate SpinnerNumberModel
to me. E.G.
import javax.swing.*;
public class FloatSpinner {
public static void main(String[] args) {
Runnable r = new Runnable() {
@Override
public void run() {
SpinnerNumberModel floatModel = new SpinnerNumberModel(
2.14f, 0f, 3f, .01f);
JSpinner spinner = new JSpinner(floatModel);
JOptionPane.showMessageDialog(null, spinner);
System.out.println(
"User Chose: " + floatModel.getNumber().floatValue());
}
};
SwingUtilities.invokeLater(r);
}
}
Upvotes: 1