Anpassung des Button designs

This commit is contained in:
Yvonne Schmidt 2024-11-15 18:39:21 +01:00
parent 2e0d1c059d
commit 8ab37e73c1
2 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package pp.monopoly.client;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad;
@ -10,6 +11,7 @@ import com.simsilica.lemur.Button;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import pp.dialog.Dialog;
@ -57,6 +59,15 @@ public class StartMenu extends Dialog {
startButton.setPreferredSize(new Vector3f(190, 60, 0)); // Increase button size (width, height)
startButton.setFontSize(40); // Set the font size for the button text
startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally
// Set a custom border and background color
ColorRGBA borderColor = ColorRGBA.Orange; // Example: White border
ColorRGBA backgroundColor = ColorRGBA.LightGray; // Example: light gray background
QuadBackgroundComponent backgroundColorSp = new QuadBackgroundComponent(backgroundColor);
backgroundColorSp.setMargin(2, 2); // Optional: Adjust margin for the border
backgroundColorSp.setColor(borderColor); // Set border color
startButton.setBackground(backgroundColorSp);
startButton.addClickCommands(source -> startGame(app));
centerMenu.addChild(startButton);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 KiB