mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch 'origin/GT-3579_rev308_integer_spinner_fixes'
This commit is contained in:
commit
47b71c4740
1 changed files with 13 additions and 9 deletions
|
@ -28,7 +28,7 @@ import javax.swing.event.*;
|
||||||
import docking.widgets.textfield.IntegerTextField;
|
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 {
|
public class IntegerSpinner {
|
||||||
|
|
||||||
|
@ -46,10 +46,11 @@ public class IntegerSpinner {
|
||||||
|
|
||||||
spinner = new JSpinner(spinnerModel);
|
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");
|
integerTextField.getComponent().setName("integer.spinner.editor");
|
||||||
Long maximum = (Long) spinnerModel.getMaximum();
|
Number maximum = (Number) spinnerModel.getMaximum();
|
||||||
integerTextField.setMaxValue(maximum == null ? null : BigInteger.valueOf(maximum));
|
integerTextField.setMaxValue(
|
||||||
|
maximum == null ? null : BigInteger.valueOf(maximum.longValue()));
|
||||||
|
|
||||||
spinner.setEditor(integerTextField.getComponent());
|
spinner.setEditor(integerTextField.getComponent());
|
||||||
|
|
||||||
|
@ -89,15 +90,13 @@ public class IntegerSpinner {
|
||||||
if (previousValue != null) {
|
if (previousValue != null) {
|
||||||
spinner.setValue(previousValue);
|
spinner.setValue(previousValue);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Object nextValue = model.getNextValue();
|
Object nextValue = model.getNextValue();
|
||||||
if (nextValue != null) {
|
if (nextValue != null) {
|
||||||
spinner.setValue(nextValue);
|
spinner.setValue(nextValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (IllegalArgumentException iae) {
|
||||||
catch (IllegalArgumentException iae) {
|
|
||||||
// ignored
|
// 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() {
|
public JSpinner getSpinner() {
|
||||||
return spinner;
|
return spinner;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +123,7 @@ public class IntegerSpinner {
|
||||||
/**
|
/**
|
||||||
* Returns the IntegerTextField that has been attached to the spinner.
|
* 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() {
|
public IntegerTextField getTextField() {
|
||||||
return integerTextField;
|
return integerTextField;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue