Deckhelper korrigiert

This commit is contained in:
Simon Wilkening 2024-11-25 06:30:04 +01:00
parent 88409dcc99
commit 16b4dbae18

View File

@ -5,12 +5,10 @@ import java.util.Random;
import com.jme3.font.BitmapText; import com.jme3.font.BitmapText;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.simsilica.lemur.Axis; import com.simsilica.lemur.*;
import com.simsilica.lemur.Button; import com.simsilica.lemur.component.IconComponent;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.Panel;
import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout; import com.simsilica.lemur.component.SpringGridLayout;
@ -39,7 +37,6 @@ public class Toolbar extends Dialog {
* Konstruktor für die Toolbar. * Konstruktor für die Toolbar.
* *
* @param app Die Hauptanwendung (MonopolyApp) * @param app Die Hauptanwendung (MonopolyApp)
* @param cube Der Würfel, der bewegt werden soll
*/ */
public Toolbar(MonopolyApp app) { public Toolbar(MonopolyApp app) {
super(app.getDialogManager()); super(app.getDialogManager());
@ -92,23 +89,43 @@ public class Toolbar extends Dialog {
Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y)); Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0)); // Adjust size as needed horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0)); // Adjust size as needed
// Create the first container (leftContainer) // Create the first container (leftContainer)
Container leftContainer = new Container(); Container leftContainer = new Container();
leftContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed leftContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
leftContainer.addChild(new Label("Left Container", new ElementId("label")));
leftContainer.addChild(new Button("Button 1")); Label imageLabel = new Label("");
IconComponent icon = new IconComponent("Pictures/dice/one.png"); // Icon mit Textur erstellen
icon.setIconSize(new Vector2f(100,100)); // Skalierung des Bildes
imageLabel.setIcon(icon);
Label imageLabel2 = new Label("");
IconComponent icon2 = new IconComponent("Pictures/dice/two.png"); // Icon mit Textur erstellen
icon2.setIconSize(new Vector2f(100,100)); // Skalierung des Bildes
imageLabel2.setIcon(icon2);
// Create the second container (rightContainer) // Create the second container (rightContainer)
Container rightContainer = new Container(); Container rightContainer = new Container();
rightContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed rightContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
rightContainer.addChild(new Label("Right Container", new ElementId("label"))); leftContainer.setBackground(null);
rightContainer.addChild(new Button("Button 2")); rightContainer.setBackground(null);
diceContainer.setBackground(null);
horizontalContainer.setBackground(null);
imageLabel.setTextVAlignment(VAlignment.Center);
imageLabel.setTextHAlignment(HAlignment.Center);
imageLabel2.setTextVAlignment(VAlignment.Center);
imageLabel2.setTextHAlignment(HAlignment.Center);
leftContainer.addChild(imageLabel);
rightContainer.addChild(imageLabel2);
// Add leftContainer and rightContainer to the horizontal container // Add leftContainer and rightContainer to the horizontal container
horizontalContainer.addChild(leftContainer); horizontalContainer.addChild(leftContainer);
horizontalContainer.addChild(rightContainer); horizontalContainer.addChild(rightContainer);
// Add the horizontalContainer to the diceContainer (top section) // Add the horizontalContainer to the diceContainer (top section)
diceContainer.addChild(horizontalContainer); diceContainer.addChild(horizontalContainer);
// Add the Würfeln button directly below the horizontalContainer // Add the Würfeln button directly below the horizontalContainer