mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GT-3579 - Fixed type casts
This commit is contained in:
parent
534fd5253a
commit
a7ea897acb
1 changed files with 13 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue