浏览代码

LogIn Window is styled to match the general style

toomanysugar 4 年之前
父节点
当前提交
836ad37367

+ 2 - 1
src/main/java/com/moviesdb/BrowserController.java

@@ -539,7 +539,8 @@ public class BrowserController extends Controller {
             Parent root = loader.load();
             logInWindow = loader.getController();
             logInWindow.stage = new Stage();
-            logInWindow.stage.setScene(new Scene(root, 250, 175));
+            logInWindow.stage.setScene(new Scene(root, 260, 204));
+            logInWindow.stage.initStyle(StageStyle.UNDECORATED);
             logInWindow.stage.setUserData(loader);
             logInWindow.open(this);
 

+ 3 - 0
src/main/java/com/moviesdb/LogInController.java

@@ -25,6 +25,9 @@ public class LogInController extends Controller {
 
     public void open(Object caller) {
         prepare();
+
+        initTopBorderDrag();
+
         stage.initModality(Modality.WINDOW_MODAL);
         stage.initOwner(((BrowserController)caller).stage.getScene().getWindow());
         this.caller = caller;

+ 71 - 66
src/main/resources/LogInController.fxml

@@ -1,77 +1,82 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!--
-  Copyright (c) 2015, 2019, Gluon and/or its affiliates.
-  All rights reserved. Use is subject to license terms.
-
-  This file is available and licensed under the following license:
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-
-  - Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-  - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the distribution.
-  - Neither the name of Oracle Corporation nor the names of its
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
+<?import javafx.scene.Cursor?>
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.Label?>
 <?import javafx.scene.control.TextField?>
 <?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.layout.BorderPane?>
 <?import javafx.scene.layout.Pane?>
 <?import javafx.scene.text.Font?>
 <?import javafx.scene.text.TextFlow?>
 
-<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="175.0" prefWidth="250.0" style="-fx-background-color: #121212;" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.moviesdb.LogInController">
-   <children>
-      <Label layoutX="14.0" layoutY="14.0" text="Log in" textFill="#9f9f9f">
-         <font>
-            <Font size="24.0" />
-         </font>
-      </Label>
-      <TextField fx:id="userTextBox1" layoutX="80.0" layoutY="49.0" style="-fx-background-color: #121212; -fx-text-fill: #9f9f9f;" />
-      <TextField fx:id="passTextBox1" layoutX="80.0" layoutY="92.0" style="-fx-background-color: #121212; -fx-text-fill: #9f9f9f;" />
-      <Label layoutX="14.0" layoutY="55.0" text="Username" textFill="#9f9f9f">
-         <font>
-            <Font size="14.0" />
-         </font></Label>
-      <Label layoutX="14.0" layoutY="96.0" text="Password" textFill="#9f9f9f">
-         <font>
-            <Font size="14.0" />
-         </font></Label>
-      <Button fx:id="logInButton21" layoutX="190.0" layoutY="141.0" mnemonicParsing="false" onMouseClicked="#closeLoginForm" style="-fx-background-color: #9f9f9f;" text="Sign in" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="15.0" />
-      <Pane layoutX="80.0" layoutY="75.0" prefHeight="3.0" prefWidth="149.0" style="-fx-background-color: #9f9f9f;" />
-      <Pane layoutX="80.0" layoutY="117.0" prefHeight="3.0" prefWidth="149.0" style="-fx-background-color: #9f9f9f;" />
-      <TextFlow fx:id="errorTextBox" layoutX="14.0" layoutY="134.0" prefHeight="25.0" prefWidth="159.0" />
-      <Label fx:id="closeButton" layoutX="221.0" layoutY="14.0" onMouseClicked="#closeStage" prefHeight="16.0" prefWidth="16.0" AnchorPane.rightAnchor="4.0" AnchorPane.topAnchor="4.0">
-         <font>
-            <Font name="Arimo" size="12.0" />
-         </font>
-      </Label>
-
-      <Label fx:id="minimizeButton" layoutX="201.0" layoutY="4.0" onMouseClicked="#minimizeStage" prefHeight="16.0" prefWidth="16.0" AnchorPane.rightAnchor="24.0" AnchorPane.topAnchor="4.0">
-         <font>
-            <Font name="Arimo" size="12.0" />
-         </font>
-      </Label>
+<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="0.0" prefHeight="204.0" prefWidth="260.0" stylesheets="@AddMovieWindowStyle.css" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.moviesdb.LogInController">
+   <right>
+      <Pane fx:id="borderRight" maxWidth="5.0" prefHeight="520.0" prefWidth="230.0" style="-fx-background-color: #121212;" BorderPane.alignment="CENTER">
+         <cursor>
+            <Cursor fx:constant="DEFAULT" />
+         </cursor></Pane>
+   </right>
+   <bottom>
+      <Pane fx:id="borderBottom" prefHeight="5.0" prefWidth="755.0" style="-fx-background-color: #121212;" BorderPane.alignment="CENTER">
+         <cursor>
+            <Cursor fx:constant="DEFAULT" />
+         </cursor></Pane>
+   </bottom>
+   <center>
+      <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="175.0" prefWidth="250.0" style="-fx-background-color: #212121;" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1">
+		   <children>
+		      <Label layoutX="14.0" layoutY="14.0" text="Log in" textFill="#9f9f9f">
+		         <font>
+		            <Font size="24.0" />
+		         </font>
+		      </Label>
+		      <TextField fx:id="userTextBox1" layoutX="80.0" layoutY="49.0" style="-fx-background-color: transparent; -fx-text-fill: #9f9f9f;" />
+		      <TextField fx:id="passTextBox1" layoutX="80.0" layoutY="92.0" style="-fx-background-color: transparent; -fx-text-fill: #9f9f9f;" />
+		      <Label layoutX="14.0" layoutY="55.0" text="Username" textFill="#9f9f9f">
+		         <font>
+		            <Font size="14.0" />
+		         </font></Label>
+		      <Label layoutX="14.0" layoutY="96.0" text="Password" textFill="#9f9f9f">
+		         <font>
+		            <Font size="14.0" />
+		         </font></Label>
+		      <Button fx:id="logInButton21" layoutX="190.0" layoutY="141.0" mnemonicParsing="false" onMouseClicked="#closeLoginForm" style="-fx-background-color: #9f9f9f;" text="Sign in" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="15.0" />
+		      <Pane layoutX="80.0" layoutY="75.0" prefHeight="3.0" prefWidth="149.0" style="-fx-background-color: #9f9f9f;" />
+		      <Pane layoutX="80.0" layoutY="117.0" prefHeight="3.0" prefWidth="149.0" style="-fx-background-color: #9f9f9f;" />
+		      <TextFlow fx:id="errorTextBox" layoutX="14.0" layoutY="134.0" prefHeight="25.0" prefWidth="159.0" />
 
-   </children>
-</AnchorPane>
+		   </children>
+		</AnchorPane>
+   </center>
+   <left>
+      <Pane fx:id="borderLeft" maxWidth="5.0" prefWidth="10.0" style="-fx-background-color: #121212;" BorderPane.alignment="CENTER">
+         <cursor>
+            <Cursor fx:constant="DEFAULT" />
+         </cursor></Pane>
+   </left>
+   <top>
+      <AnchorPane fx:id="borderTop" maxHeight="24.0" prefHeight="24.0" style="-fx-background-color: #121212;" BorderPane.alignment="CENTER">
+         <children>
+   	  	   		<Label fx:id="closeButton" onMouseClicked="#closeStage" prefHeight="16.0" prefWidth="16.0" AnchorPane.bottomAnchor="4.0" AnchorPane.rightAnchor="4.0" AnchorPane.topAnchor="4.0">
+   	  		      <font>
+   	  		          <Font name="Arimo" size="12.0" />
+   	  		      </font>
+   	  		    </Label>
+   		    <Label fx:id="minimizeButton" onMouseClicked="#minimizeStage" prefHeight="16.0" prefWidth="16.0" AnchorPane.bottomAnchor="4.0" AnchorPane.rightAnchor="24.0" AnchorPane.topAnchor="4.0">
+   		        <font>
+   		            <Font name="Arimo" size="12.0" />
+   		        </font>
+   		    </Label>
+            <Label layoutX="10.0" layoutY="2.0" text="Title" textFill="#9f9f9f" visible="false" AnchorPane.bottomAnchor="2.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="2.0">
+               <font>
+                  <Font size="14.0" />
+               </font>
+            </Label>
+         </children>
+         <cursor>
+            <Cursor fx:constant="DEFAULT" />
+         </cursor>
+      </AnchorPane>
+   </top>
+</BorderPane>