Hide arrows in the spinner (they will cause the change listener to run)

This commit is contained in:
sdburns1998
2019-06-18 19:42:04 +02:00
parent 07d702358f
commit 4689794dd3

View File

@@ -75,6 +75,7 @@ import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.basic.BasicSpinnerUI;
import javax.swing.text.JTextComponent;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.config.ChatColorConfig;
@@ -721,6 +722,15 @@ public class ConfigPanel extends PluginPanel
Component editor = spinner.getEditor();
JFormattedTextField spinnerTextField = ((JSpinner.DefaultEditor) editor).getTextField();
spinnerTextField.setColumns(SPINNER_FIELD_WIDTH);
spinner.setUI(new BasicSpinnerUI() {
protected Component createNextButton() {
return null;
}
protected Component createPreviousButton() {
return null;
}
});
spinner.addChangeListener((ce) ->
{
changeConfiguration(listItem, config, spinner, cd, cid);