Skip to content

Commit

Permalink
fix button selector cut off on low resolution screens
Browse files Browse the repository at this point in the history
  • Loading branch information
zocker-160 committed Dec 27, 2024
1 parent 6a6d7b0 commit a8dad59
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/EEmodders/datmanager/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void dbSelector() throws IOException {
dbSelectorController = controller;
controller.setLoadDBButton("Select DAT folder for "+aoc);
controller.setVersionLabel(Settings.VERSION);
controller.setCreditLabel(Settings.DB_ICON_CREDIT+" (King rocks balls!!)");
controller.setCreditLabel(Settings.DB_ICON_CREDIT);

stage.setTitle(Settings.NAME +" ("+aoc+")");
stage.getIcons().add(Util.getDBEditorIcon());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/EEmodders/datmanager/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public class Settings {
public static final int LOAD_MAX_WAIT = 10000;

public static final String DB_ICON = "DBE_icon.png";
public static final String DB_ICON_CREDIT = "Icon created by Fortuking"; // (King rocks balls!!)
public static final String DB_ICON_CREDIT = "Icon by Fortuking"; // (King rocks balls!!)
public static final String EES_URL = "https://github.com/EE-modders/Empire-Earth-Studio-2";
}
12 changes: 9 additions & 3 deletions src/main/java/EEmodders/gui/scenes/DBSelectorController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import EEmodders.gui.MainFrame;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.text.TextAlignment;
Expand Down Expand Up @@ -70,7 +72,7 @@ public void setDBButtons(List<DatFile> fileList) {
btn.setText(datfile.getPrettyName());
btn.setTextAlignment(TextAlignment.CENTER);
btn.setAlignment(Pos.CENTER);
btn.setPrefSize(150, 40);
btn.setPrefSize(150, 25);

var eventHandler = new EventHandler<MouseEvent>() {
@Override
Expand All @@ -83,9 +85,13 @@ public void handle(MouseEvent event) {
buttonGrid.add(btn, i%3, i/3);
}

borderPane.setCenter(buttonGrid);
var scroll = new ScrollPane(buttonGrid);
scroll.setPadding(new Insets(10));
scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

borderPane.setCenter(scroll);

Core.getStage().setWidth(500);
Core.getStage().setHeight(950);
Core.getStage().setHeight(850);
}
}
14 changes: 8 additions & 6 deletions src/main/resources/EEmodders/gui/scenes/dbSelector.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<AnchorPane prefHeight="473.0" prefWidth="364.0" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1" fx:controller="EEmodders.gui.scenes.DBSelectorController">
<AnchorPane prefHeight="473.0" prefWidth="364.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="EEmodders.gui.scenes.DBSelectorController">
<children>
<BorderPane fx:id="borderPane" prefHeight="336.0" prefWidth="451.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<bottom>
Expand All @@ -36,7 +36,7 @@
<top>
<StackPane prefHeight="150.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<ImageView fitHeight="332.0" fitWidth="394.0" pickOnBounds="true" preserveRatio="true">
<ImageView fitHeight="250.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../DBE_icon.png" />
</image>
Expand All @@ -48,14 +48,16 @@
<Font name="System Bold" size="12.0" />
</font>
</Label>
<Label fx:id="creditLabel" alignment="BOTTOM_RIGHT" contentDisplay="CENTER" text="&lt;icon credit&gt;" textAlignment="CENTER" textFill="WHITE">
</children>
</VBox>
<AnchorPane prefHeight="200.0" prefWidth="200.0">
<children>
<Label fx:id="creditLabel" alignment="CENTER" contentDisplay="CENTER" text="&lt;icon credit&gt;" textAlignment="CENTER" textFill="WHITE" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<font>
<Font size="12.0" />
</font>
</Label>
</children>
</VBox>
<AnchorPane prefHeight="200.0" prefWidth="200.0" />
</children></AnchorPane>
</children>
</StackPane>
</top>
Expand Down

0 comments on commit a8dad59

Please sign in to comment.