diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/spinner/IntegerSpinner.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/spinner/IntegerSpinner.java index eb51b13d85..b72887b89b 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/spinner/IntegerSpinner.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/spinner/IntegerSpinner.java @@ -28,7 +28,7 @@ import javax.swing.event.*; import docking.widgets.textfield.IntegerTextField; /** - * Creates a component for editing Integer values using an integerTextField and a Jspinner. + * Creates a component for editing Integer values using an {@link IntegerTextField} and a {@link JSpinner}. */ public class IntegerSpinner { @@ -46,10 +46,11 @@ public class IntegerSpinner { spinner = new JSpinner(spinnerModel); - integerTextField = new IntegerTextField(10, (Long) spinnerModel.getValue()); + integerTextField = new IntegerTextField(10, ((Number) spinnerModel.getValue()).longValue()); integerTextField.getComponent().setName("integer.spinner.editor"); - Long maximum = (Long) spinnerModel.getMaximum(); - integerTextField.setMaxValue(maximum == null ? null : BigInteger.valueOf(maximum)); + Number maximum = (Number) spinnerModel.getMaximum(); + integerTextField.setMaxValue( + maximum == null ? null : BigInteger.valueOf(maximum.longValue())); spinner.setEditor(integerTextField.getComponent()); @@ -89,15 +90,13 @@ public class IntegerSpinner { if (previousValue != null) { spinner.setValue(previousValue); } - } - else { + } else { Object nextValue = model.getNextValue(); if (nextValue != null) { spinner.setValue(nextValue); } } - } - catch (IllegalArgumentException iae) { + } catch (IllegalArgumentException iae) { // ignored } }); @@ -112,6 +111,11 @@ public class IntegerSpinner { } + /** + * Returns the JSpinner that has been attached to the text field. + * + * @return the JSpinner that has been attached to the text field + */ public JSpinner getSpinner() { return spinner; } @@ -119,7 +123,7 @@ public class IntegerSpinner { /** * Returns the IntegerTextField that has been attached to the spinner. * - * @return the IntegerTextField that has been attached to the spinner. + * @return the IntegerTextField that has been attached to the spinner. */ public IntegerTextField getTextField() { return integerTextField;