set default value for drop down selection

This commit is contained in:
Johannes Schmelz 2024-11-26 21:28:41 +01:00
parent 29cc73e83b
commit 89587a4c78
2 changed files with 8 additions and 3 deletions

View File

@ -68,7 +68,7 @@ public class ChoosePartner extends Dialog {
// Add buttons
mainContainer.addChild(createButtonContainer());
addSelectionActionListener(playerSelector, this::onDropdownSelectionChanged);
addSelectionActionListener(playerSelector, this::onDropdownSelectionChanged);
// Attach main container to GUI node
app.getGuiNode().attachChild(mainContainer);
@ -104,6 +104,7 @@ public class ChoosePartner extends Dialog {
dimens2.setX( dimens.getX() );
playerSelector.getPopupContainer().setPreferredSize(new Vector3f(200,200,3));
playerSelector.setLocalTranslation(0,0,5);
onDropdownSelectionChanged(playerOptions.get(0));
return dropdownContainer;
}
@ -211,6 +212,7 @@ public class ChoosePartner extends Dialog {
@Override
protected void initialize(Application app) {
update(1);
}
@Override

View File

@ -47,7 +47,7 @@ public class LobbyMenu extends Dialog {
super(app.getDialogManager());
this.app = app;
playerInputField = new TextField("Spieler "+app.getId()+1);
playerInputField = new TextField("Spieler "+(app.getId()+1));
// Hintergrundbild laden und hinzufügen
addBackgroundImage();
@ -120,6 +120,8 @@ public class LobbyMenu extends Dialog {
figures.add("OOP");
figures.add("Handyholster");
Selector<String> figureDropdown = new Selector<>(figures, "glass");
figureDropdown.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray));
figureDropdown.setPreferredSize(new Vector3f(100, 20, 0));
@ -128,7 +130,8 @@ public class LobbyMenu extends Dialog {
Vector3f dimens2 = figureDropdown.getPopupContainer().getPreferredSize();
dimens2.setX( dimens.getX() );
figureDropdown.getPopupContainer().setPreferredSize(new Vector3f(200,200,5));
figureDropdown.getSelectionModel().setSelection(0);
figure = "Laptop";
addSelectionActionListener(figureDropdown, this::onDropdownSelectionChanged);