Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
  • Loading branch information
cubewhy committed Jan 13, 2024
2 parents eea91f2 + 8d9a1e6 commit 9a8f9ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/cubewhy/celestial/files/ConfigFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ConfigFile setValue(String key, char value) {
return this.save();
}

public ConfigFile setValue(String key, int value) {
public ConfigFile setValue(String key, Number value) {
this.config.addProperty(key, value);
return this.save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private void addUnclaimed(JPanel basePanel, Set<Map.Entry<String, JsonElement>>
JPanel panel = new JPanel();
if (value.isBoolean()) {
JCheckBox cb = new JCheckBox(key);
cb.setSelected(value.getAsBoolean());
cb.addActionListener((e) -> {
JCheckBox source = (JCheckBox) e.getSource();
config.setValue(key, source.isSelected());
Expand All @@ -146,6 +147,11 @@ private void addUnclaimed(JPanel basePanel, Set<Map.Entry<String, JsonElement>>
spinner.setAutoscrolls(true);
JComponent editor = spinner.getEditor();
JFormattedTextField textField = ((JSpinner.DefaultEditor) editor).getTextField();
spinner.addChangeListener((e) -> {
JSpinner source = (JSpinner) e.getSource();
Number v = (Number) source.getValue();
config.setValue(key, v);
});
textField.setColumns(20);
panel.add(spinner);

Expand Down

0 comments on commit 9a8f9ec

Please sign in to comment.