Make JSpinner only read numbers but also detect backspace
问题 I'm trying to make a JSpinner that will only accepts numbers but I also want it to read/respond to backspace. public class test { JFrame frame; JPanel panel; JSpinner spinner; public test() { frame = new JFrame("test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(200,200)); panel = new JPanel(); SpinnerNumberModel numSpin = new SpinnerNumberModel(10, 0,1000,1); spinner = new JSpinner(numSpin); JFormattedTextField txt = ((JSpinner.NumberEditor)