replaced text displays with labels

This commit is contained in:
Yvonne Schmidt 2024-12-07 14:54:55 +01:00
parent 5f4c6be7b8
commit 944b6b674e
6 changed files with 41 additions and 14 deletions

View File

@ -3,6 +3,7 @@
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling // https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
import com.jme3.math.ColorRGBA import com.jme3.math.ColorRGBA
import com.jme3.texture.Texture
import com.simsilica.lemur.* import com.simsilica.lemur.*
import com.simsilica.lemur.component.QuadBackgroundComponent import com.simsilica.lemur.component.QuadBackgroundComponent
import com.simsilica.lemur.Button import com.simsilica.lemur.Button
@ -47,6 +48,23 @@ def orangeBorder = TbtQuadBackgroundComponent.create(
1f, false) 1f, false)
orangeBorder.color = color(1, 0.5, 0, 1) // Orange color orangeBorder.color = color(1, 0.5, 0, 1) // Orange color
def createCustomBackground(app) {
// Load the texture from the assets
Texture texture = app.getAssetManager().loadTexture("Pictures/kontobg.png")
// Create the TbtQuadBackgroundComponent
def backgroundCustom = TbtQuadBackgroundComponent.create(
texture, // The texture to use
1, 1, 1, // Insets for the 9-patch behavior
126, 126, // The size of the texture
1f, // The scale factor
false // No tiling
)
return backgroundCustom
}
selector("pp") { selector("pp") {
font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt") font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt")
} }
@ -366,3 +384,12 @@ selector("button-toolbar", "pp") {
} }
selector("button-toolbar2", "pp") {
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
textHAlignment = HAlignment.Center
textVAlignment = VAlignment.Center
buttonCommands = stdButtonCommandsToolbar
}

View File

@ -257,7 +257,7 @@ public class Toolbar extends Dialog implements GameEventListener {
} }
private Button createPropertyMenuButton() { private Button createPropertyMenuButton() {
propertyMenuButton = new Button("", new ElementId("button-toolbar")); propertyMenuButton = new Button("", new ElementId("button-toolbar2"));
propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0)); propertyMenuButton.setPreferredSize(new Vector3f(150, 50, 0));
String iconBuildingPath = "icons/icon-gebaude.png"; String iconBuildingPath = "icons/icon-gebaude.png";

View File

@ -40,8 +40,8 @@ public class BuyHouse extends Dialog {
/** Background container providing a border for the popup. */ /** Background container providing a border for the popup. */
private final Container backgroundContainer; private final Container backgroundContainer;
/** TextField to display selected properties. */ /** Label to display selected properties. */
private TextField selectionDisplay; private Label selectionDisplay;
/** Reference for tracking dropdown selection changes. */ /** Reference for tracking dropdown selection changes. */
private VersionedReference<Set<Integer>> selectionRef; private VersionedReference<Set<Integer>> selectionRef;
@ -162,7 +162,7 @@ public class BuyHouse extends Dialog {
selectionRef = propertySelector.getSelectionModel().createReference(); selectionRef = propertySelector.getSelectionModel().createReference();
// Initialize the selection display here // Initialize the selection display here
selectionDisplay = new TextField(""); // Create TextField for displaying selections selectionDisplay = new Label("");
selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0));
dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container

View File

@ -45,8 +45,8 @@ public class RepayMortage extends Dialog {
/** Background container providing a border for the popup. */ /** Background container providing a border for the popup. */
private final Container backgroundContainer; private final Container backgroundContainer;
/** Text field to display selected properties. */ /** Label to display selected properties. */
private TextField selectionDisplay; private Label selectionDisplay;
/** Reference to track property selections in the dropdown menu. */ /** Reference to track property selections in the dropdown menu. */
private VersionedReference<Set<Integer>> selectionRef; private VersionedReference<Set<Integer>> selectionRef;
@ -166,7 +166,7 @@ public class RepayMortage extends Dialog {
selectionRef = propertySelector.getSelectionModel().createReference(); selectionRef = propertySelector.getSelectionModel().createReference();
// Initialize the selection display here // Initialize the selection display here
selectionDisplay = new TextField(""); // Create TextField for displaying selections selectionDisplay = new Label(""); // Create TextField for displaying selections
selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0));
dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container

View File

@ -45,8 +45,8 @@ public class SellHouse extends Dialog {
/** Background container providing a styled border around the main dialog. */ /** Background container providing a styled border around the main dialog. */
private final Container backgroundContainer; private final Container backgroundContainer;
/** Text field to display selected properties. */ /** Label to display selected properties. */
private TextField selectionDisplay; private Label selectionDisplay;
/** Reference to track selection changes in the property selector. */ /** Reference to track selection changes in the property selector. */
private VersionedReference<Set<Integer>> selectionRef; private VersionedReference<Set<Integer>> selectionRef;
@ -86,7 +86,7 @@ public class SellHouse extends Dialog {
title.setFontSize(48); title.setFontSize(48);
title.setColor(ColorRGBA.Black); title.setColor(ColorRGBA.Black);
//Unterteilund des sellHouseContainer in drei "Untercontainer" //Unterteilung des sellHouseContainer in drei "Untercontainer"
Container upContainer = sellhouseContainer.addChild(new Container()); Container upContainer = sellhouseContainer.addChild(new Container());
Container middleContainer = sellhouseContainer.addChild(new Container()); Container middleContainer = sellhouseContainer.addChild(new Container());
Container downContainer = sellhouseContainer.addChild(new Container()); Container downContainer = sellhouseContainer.addChild(new Container());
@ -172,7 +172,7 @@ public class SellHouse extends Dialog {
selectionRef = propertySelector.getSelectionModel().createReference(); selectionRef = propertySelector.getSelectionModel().createReference();
// Initialize the selection display here // Initialize the selection display here
selectionDisplay = new TextField(""); // Create TextField for displaying selections selectionDisplay = new Label("");
selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0));
dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container

View File

@ -46,8 +46,8 @@ public class TakeMortage extends Dialog {
/** Background container providing a styled border around the main dialog. */ /** Background container providing a styled border around the main dialog. */
private final Container backgroundContainer; private final Container backgroundContainer;
/** Text field to display selected properties. */ /** Label to display selected properties. */
private TextField selectionDisplay; private Label selectionDisplay;
/** Reference to track selection changes in the property selector. */ /** Reference to track selection changes in the property selector. */
private VersionedReference<Set<Integer>> selectionRef; private VersionedReference<Set<Integer>> selectionRef;
@ -172,7 +172,7 @@ public class TakeMortage extends Dialog {
selectionRef = propertySelector.getSelectionModel().createReference(); selectionRef = propertySelector.getSelectionModel().createReference();
// Initialize the selection display here // Initialize the selection display here
selectionDisplay = new TextField(""); // Create TextField for displaying selections selectionDisplay = new Label(""); // Create TextField for displaying selections
selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0)); selectionDisplay.setPreferredSize(new Vector3f(300, 30, 0));
dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container dropdownContainer.addChild(selectionDisplay); // Add it to the dropdown container