mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-18 16:26:05 -04:00
Add a separator to separate launch button and popup button
This commit is contained in:
parent
61ab8a6769
commit
9c169fb560
@ -28,6 +28,7 @@ import javafx.scene.Node;
|
|||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.shape.Rectangle;
|
import javafx.scene.shape.Rectangle;
|
||||||
import org.jackhuang.hmcl.event.EventBus;
|
import org.jackhuang.hmcl.event.EventBus;
|
||||||
import org.jackhuang.hmcl.event.RefreshedVersionsEvent;
|
import org.jackhuang.hmcl.event.RefreshedVersionsEvent;
|
||||||
@ -61,6 +62,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
private JFXButton btnMenu;
|
private JFXButton btnMenu;
|
||||||
@FXML
|
@FXML
|
||||||
private Label lblCurrentGame;
|
private Label lblCurrentGame;
|
||||||
|
@FXML
|
||||||
|
private Rectangle separator;
|
||||||
|
|
||||||
private Profile profile;
|
private Profile profile;
|
||||||
{
|
{
|
||||||
@ -74,14 +77,14 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
});
|
});
|
||||||
|
|
||||||
btnLaunch.setClip(new Rectangle(-100, -100, 280, 200));
|
btnLaunch.setClip(new Rectangle(-100, -100, 280, 200));
|
||||||
btnMenu.setClip(new Rectangle(180, -100, 100, 200));
|
btnMenu.setClip(new Rectangle(181, -100, 100, 200));
|
||||||
menu.setMinWidth(200);
|
menu.setMinWidth(200);
|
||||||
|
|
||||||
StackPane graphic = new StackPane();
|
StackPane graphic = new StackPane();
|
||||||
Node svg = SVG.triangle(Theme.whiteFillBinding(), 10, 10);
|
Node svg = SVG.triangle(Theme.whiteFillBinding(), 10, 10);
|
||||||
StackPane.setAlignment(svg, Pos.CENTER_RIGHT);
|
StackPane.setAlignment(svg, Pos.CENTER_RIGHT);
|
||||||
graphic.getChildren().setAll(svg);
|
graphic.getChildren().setAll(svg);
|
||||||
graphic.setTranslateX(11);
|
graphic.setTranslateX(12);
|
||||||
btnMenu.setGraphic(graphic);
|
btnMenu.setGraphic(graphic);
|
||||||
|
|
||||||
Profiles.selectedVersionProperty().addListener((o, a, version) -> {
|
Profiles.selectedVersionProperty().addListener((o, a, version) -> {
|
||||||
@ -113,7 +116,6 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
.sorted((a, b) -> VersionNumber.COMPARATOR.compare(VersionNumber.asVersion(a.getId()), VersionNumber.asVersion(b.getId())))
|
.sorted((a, b) -> VersionNumber.COMPARATOR.compare(VersionNumber.asVersion(a.getId()), VersionNumber.asVersion(b.getId())))
|
||||||
.map(version -> new IconedMenuItem(null, version.getId(), () -> {
|
.map(version -> new IconedMenuItem(null, version.getId(), () -> {
|
||||||
repository.getProfile().setSelectedVersion(version.getId());
|
repository.getProfile().setSelectedVersion(version.getId());
|
||||||
Versions.launch(repository.getProfile(), version.getId());
|
|
||||||
popup.hide();
|
popup.hide();
|
||||||
}))
|
}))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -233,6 +233,7 @@ public class DecoratorSkin extends SkinBase<DecoratorControl> {
|
|||||||
Rectangle separator = new Rectangle();
|
Rectangle separator = new Rectangle();
|
||||||
separator.visibleProperty().bind(refreshNavButton.visibleProperty());
|
separator.visibleProperty().bind(refreshNavButton.visibleProperty());
|
||||||
separator.heightProperty().bind(navBar.heightProperty());
|
separator.heightProperty().bind(navBar.heightProperty());
|
||||||
|
separator.setFill(Color.GRAY);
|
||||||
|
|
||||||
JFXButton btnMin = new JFXButton();
|
JFXButton btnMin = new JFXButton();
|
||||||
StackPane pane = new StackPane(minus);
|
StackPane pane = new StackPane(minus);
|
||||||
|
@ -4,21 +4,23 @@
|
|||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.shape.Rectangle?>
|
||||||
<fx:root type="StackPane" pickOnBounds="false"
|
<fx:root type="StackPane" pickOnBounds="false"
|
||||||
xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
|
xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<StackPane fx:id="main" style="-fx-padding: 25;">
|
<StackPane fx:id="main" style="-fx-padding: 25;">
|
||||||
<JFXButton prefWidth="200" prefHeight="50" buttonType="RAISED" styleClass="jfx-button-raised"
|
<StackPane maxWidth="200" maxHeight="50" StackPane.alignment="BOTTOM_RIGHT">
|
||||||
onMouseClicked="#launch" fx:id="btnLaunch"
|
<JFXButton prefWidth="200" prefHeight="50" buttonType="RAISED" styleClass="jfx-button-raised"
|
||||||
StackPane.alignment="BOTTOM_RIGHT">
|
onMouseClicked="#launch" fx:id="btnLaunch">
|
||||||
<graphic>
|
<graphic>
|
||||||
<VBox alignment="CENTER" translateX="-10" maxWidth="160">
|
<VBox alignment="CENTER" translateX="-7" maxWidth="160">
|
||||||
<Label style="-fx-font-size: 15;" text="%version.launch" />
|
<Label style="-fx-font-size: 15;" text="%version.launch"/>
|
||||||
<Label style="-fx-font-size: 10px;" fx:id="lblCurrentGame" />
|
<Label style="-fx-font-size: 10px;" fx:id="lblCurrentGame"/>
|
||||||
</VBox>
|
</VBox>
|
||||||
</graphic>
|
</graphic>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton prefWidth="200" prefHeight="50" buttonType="RAISED" styleClass="jfx-button-raised"
|
<Rectangle fx:id="separator" translateX="80" height="52" fill="gray" width="1" mouseTransparent="true"/>
|
||||||
style="-fx-font-size: 15;" onMouseClicked="#onMenu"
|
<JFXButton prefWidth="200" prefHeight="50" buttonType="RAISED" styleClass="jfx-button-raised"
|
||||||
fx:id="btnMenu" StackPane.alignment="BOTTOM_RIGHT" />
|
style="-fx-font-size: 15;" onMouseClicked="#onMenu" fx:id="btnMenu" />
|
||||||
|
</StackPane>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
</fx:root>
|
</fx:root>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user