Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bar commit of EditTokenDialog #3816

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,10 @@ public boolean commit() {

// Get the states
Component[] stateComponents = getStatesPanel().getComponents();
Component barPanel = null;
Container barPanel = null;
for (Component stateComponent : stateComponents) {
if ("bar".equals(stateComponent.getName())) {
barPanel = stateComponent;
barPanel = (Container) stateComponent;
continue;
}
Component[] components = ((Container) stateComponent).getComponents();
Expand All @@ -734,10 +734,12 @@ public boolean commit() {

// BARS
if (barPanel != null) {
Component[] bars = ((Container) barPanel).getComponents();
for (int i = 0; i < bars.length; i += 2) {
JCheckBox cb = (JCheckBox) ((Container) bars[i]).getComponent(1);
JSlider bar = (JSlider) bars[i + 1];
for (var barContainer : barPanel.getComponents()) {
var barComponents = ((Container) barContainer).getComponents();

JSlider bar = (JSlider) barComponents[1];
JCheckBox cb = (JCheckBox) barComponents[2];

BigDecimal value =
cb.isSelected() ? null : new BigDecimal(bar.getValue()).divide(new BigDecimal(100));
token.setState(bar.getName(), value);
Expand Down