Fix closing page

This commit is contained in:
huanghongxun 2018-09-22 21:40:16 +08:00
parent 1b5d4c1b42
commit 332719f49a
3 changed files with 12 additions and 11 deletions

View File

@ -67,9 +67,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
{
FXUtils.loadFXML(this, "/assets/fxml/main.fxml");
btnLaunch.setClip(new Rectangle(-100, -100, 280, 200));
btnMenu.setClip(new Rectangle(181, -100, 100, 200));
menu.setMinWidth(200);
btnLaunch.setClip(new Rectangle(-100, -100, 310, 200));
btnMenu.setClip(new Rectangle(211, -100, 100, 200));
menu.getStyleClass().setAll("menu");
StackPane graphic = new StackPane();

View File

@ -79,7 +79,9 @@ public class Navigator extends StackPane {
public void close(Node from) {
FXUtils.checkFxUserThread();
stack.remove(from);
if (stack.peek() != from)
throw new IllegalStateException();
stack.pop();
Node node = stack.peek();
fireEvent(new NavigationEvent(this, from, NavigationEvent.NAVIGATING));
setContent(node);

View File

@ -8,18 +8,18 @@
<fx:root type="StackPane" pickOnBounds="false"
xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
<StackPane fx:id="main" style="-fx-padding: 25;">
<StackPane maxWidth="200" maxHeight="50" StackPane.alignment="BOTTOM_RIGHT">
<JFXButton prefWidth="200" prefHeight="50" buttonType="RAISED" styleClass="jfx-button-raised"
<StackPane maxWidth="230" maxHeight="55" StackPane.alignment="BOTTOM_RIGHT">
<JFXButton prefWidth="230" prefHeight="55" buttonType="RAISED" styleClass="jfx-button-raised"
onMouseClicked="#launch" fx:id="btnLaunch">
<graphic>
<VBox alignment="CENTER" translateX="-7" maxWidth="160">
<Label style="-fx-font-size: 15;" text="%version.launch"/>
<Label style="-fx-font-size: 10px;" fx:id="lblCurrentGame"/>
<VBox alignment="CENTER" translateX="-7" maxWidth="200">
<Label style="-fx-font-size: 16;" text="%version.launch"/>
<Label style="-fx-font-size: 12px;" fx:id="lblCurrentGame"/>
</VBox>
</graphic>
</JFXButton>
<Rectangle fx:id="separator" translateX="80" height="52" fill="gray" width="1" mouseTransparent="true"/>
<JFXButton prefWidth="200" prefHeight="50" buttonType="RAISED" styleClass="jfx-button-raised"
<Rectangle fx:id="separator" translateX="95" height="57" fill="gray" width="1" mouseTransparent="true"/>
<JFXButton prefWidth="230" prefHeight="55" buttonType="RAISED" styleClass="jfx-button-raised"
style="-fx-font-size: 15;" onMouseClicked="#onMenu" fx:id="btnMenu" />
</StackPane>
</StackPane>