Code:
public class OptionsAudioContainer extends Container {
private final float audPanelWidth, audPanelHeight;
private VersionedReference<Boolean> isSoundMuted;
public OptionsAudioContainer(Camera cam) {
this.audPanelWidth = cam.getWidth();
this.audPanelHeight = cam.getHeight();
setLayout(new BorderLayout());
setLocalTranslation(0, audPanelHeight, 0);
setPreferredSize(new Vector3f(audPanelWidth, audPanelHeight, 0));
setAlpha(0, false);
Panel leftPane = new Panel() {{
setLayout(new BorderLayout());
setPreferredSize(new Vector3f(cam.getWidth() * .23f, audPanelHeight, 0));
setAlpha(0, false);
Label chapterLabel = new Label("Настройки звука");
addChild(chapterLabel, BorderLayout.Position.North);
}};
Panel contentPane = new Panel() {{
setLayout(new BoxLayout(Axis.Y, FillMode.None));
setAlpha(0, false);
Checkbox soundMutedChk = new Checkbox("Mute sound");
soundMutedChk.setChecked(true);
isSoundMuted = soundMutedChk.getModel().createReference();
addChild(soundMutedChk);
}};
addChild(leftPane, BorderLayout.Position.West);
addChild(contentPane, BorderLayout.Position.Center);
}
}
got error:
11.10.24 19:00:02.139 [INFO] th:AWT-EventQueue-0 g.f.g.s.g.LemurUiState.showAudioOptionsMenu():67 Отображение настроек звука...
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Box layout does not take constraints.
at com.simsilica.lemur.component.BoxLayout.addChild(BoxLayout.java:241)
at com.simsilica.lemur.Container.addChild(Container.java:112)
at game.freya.gui.states.global.panes.options.OptionsAudioContainer.<init>(OptionsAudioContainer.java:53)
at game.freya.gui.states.global.LemurUiState.showAudioOptionsMenu(LemurUiState.java:68)
at game.freya.gui.states.global.OptionsState.lambda$showOptionsMenu$3(OptionsState.java:250)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
on the line “addChild(leftPane, BorderLayout.Position.West);”