2025年3月5日11:24:37

master
qmstyle 2025-03-05 11:24:46 +08:00
parent e31dfcccbf
commit 30f5bbbd14
7 changed files with 154 additions and 1 deletions

21
pom.xml
View File

@ -38,6 +38,27 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>11.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.2.1</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,38 @@
package com.zhangmeng.online.exam.ui.admin;
import com.zhangmeng.online.exam.ui.layouts.SideMenu;
import com.zhangmeng.online.exam.ui.layouts.TopMenu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
/**
* @author zm
* @date 2025/3/5 9:36
* @version: 1.0
*/
public class IndexPage extends BorderPane {
private SideMenu sideMenu = null;
public IndexPage() {
sideMenu = new SideMenu(); // 导航栏容器
StackPane contentArea = new StackPane(); // 右侧内容区
contentArea.setStyle("-fx-background-color: #3ce53c;");
AnchorPane top = new AnchorPane(); // 顶部容器
top.setStyle("-fx-background-color: #8a4ed4;");
top.setPrefHeight(40);
TopMenu topMenu = new TopMenu(); // 顶部菜单栏
top.getChildren().add(topMenu);
this.setLeft(sideMenu);
this.setCenter(contentArea);
this.setTop(top);
}
}

View File

@ -7,6 +7,8 @@ import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import javafx.stage.Window;
/**
* @author zm
@ -107,8 +109,11 @@ public class LoginPage extends AnchorPane {
button1.setOnAction(event -> {
System.out.println("登录");
Scene scene = button1.getScene();
ShortAnswerComponent shortAnswerComponent = new ShortAnswerComponent();
IndexPage shortAnswerComponent = new IndexPage();
scene.setRoot(shortAnswerComponent);
Stage window =(Stage) scene.getWindow();
window.setResizable(true);
// window.setFullScreen(true);
});
}

View File

@ -0,0 +1,23 @@
package com.zhangmeng.online.exam.ui.layouts;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
/**
* @author zm
* @date 2025/3/5 9:42
* @version: 1.0
*/
public class SideMenu extends VBox {
public SideMenu() {
this.setSpacing(10);
this.setPrefWidth(200);
this.setStyle("-fx-background-color: #2c3e50;");
}
}

View File

@ -0,0 +1,17 @@
package com.zhangmeng.online.exam.ui.layouts;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
/**
* @author zm
* @date 2025/3/5 11:09
* @version: 1.0
*/
public class TopMenu extends MenuBar {
public TopMenu() {
super();
this.prefHeight(40);
}
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="fmxl.Index"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.Button?>
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.online.exam.ui.admin.LoginController">
<children>
<GridPane layoutX="485.0" layoutY="193.0" prefHeight="183.0" prefWidth="286.0" AnchorPane.bottomAnchor="281.0"
AnchorPane.leftAnchor="485.0" AnchorPane.rightAnchor="429.0" AnchorPane.topAnchor="185.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="229.0" minWidth="10.0" prefWidth="38.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="423.0" minWidth="10.0" prefWidth="248.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="174.0" minHeight="10.0" prefHeight="60.0" vgrow="SOMETIMES"/>
<RowConstraints maxHeight="206.0" minHeight="10.0" prefHeight="47.0" vgrow="SOMETIMES"/>
<RowConstraints maxHeight="238.0" minHeight="10.0" prefHeight="52.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label text="账号"/>
<Label text="密码" GridPane.rowIndex="1"/>
<TextField GridPane.columnIndex="1"/>
<Button mnemonicParsing="false" prefHeight="23.0" prefWidth="178.0" text="登录" GridPane.columnIndex="1"
GridPane.rowIndex="2"/>
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="1"/>
</children>
</GridPane>
</children>
</AnchorPane>