Skip to content

Commit 78d2f93

Browse files
committed
code gui part
1 parent e8c60dd commit 78d2f93

File tree

10 files changed

+82
-6
lines changed

10 files changed

+82
-6
lines changed

.idea/markdown.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AssignMark.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" />
2222
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-lite:5.1.0" level="project" />
2323
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:5.0.2" level="project" />
24+
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
2425
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:5.1.0" level="project" />
2526
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.21" level="project" />
2627
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" />

src/main/java/cn/rocket/assaignmark/LocalURL.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@ private LocalURL() {
1818
// Jar associated
1919
public static final String JAR_PATH; // with /
2020
public static final String JAR_PARENT_PATH; // with /
21+
2122
// Resources associated
22-
public static final String RES_PATH = "/amres/";
23-
public static final String TEMPLATE_PATH = RES_PATH + "/core/template.xlsx";
23+
private static final String RES_PATH = "/amres/";
24+
private static final String CORE_PATH = RES_PATH + "core/";
25+
public static final String TEMPLATE_PATH = CORE_PATH + "template.xlsx";
26+
private static final String GUI_PATH = RES_PATH + "gui/";
27+
public static final String MAIN_FXML_PATH = GUI_PATH + "Main.fxml";
28+
public static final String ICON_PATH = GUI_PATH + "icon.png";
2429

2530
static {
2631
String jarPath;
2732
try {
2833
jarPath = Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
2934
} catch (URISyntaxException e) {
30-
jarPath = null;
3135
System.err.println("无法解析jar路径!");
36+
throw new RuntimeException(e);
3237
}
3338
JAR_PATH = jarPath;
3439
JAR_PARENT_PATH = new File(JAR_PATH).getParent() + "/";

src/main/java/cn/rocket/assaignmark/core/AMFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void work() {
7373
} catch (AssigningException ignored) {
7474
} catch (Exception e) {
7575
notifier.notify(AMEvent.ERR_UNEXPECTED, e.toString());
76-
e.printStackTrace();
76+
throw e;
7777
}
7878
}
7979

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
package cn.rocket.assaignmark.gui;
22

3+
import com.jfoenix.controls.JFXProgressBar;
4+
import javafx.scene.control.Label;
5+
import javafx.scene.layout.AnchorPane;
6+
37
/**
48
* @author Rocket
59
* @version 0.9.8
610
*/
711
public class Controller {
12+
public Label progressLabel;
13+
public Label statusLabel;
14+
public JFXProgressBar progressBar;
15+
public AnchorPane pane;
16+
17+
public static void main(String[] args) {
18+
19+
}
20+
21+
public void initialize() {
22+
System.out.println(pane.getStyle());
23+
}
824
}
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
package cn.rocket.assaignmark.gui;
22

3+
import cn.rocket.assaignmark.LocalURL;
34
import javafx.application.Application;
5+
import javafx.fxml.FXMLLoader;
6+
import javafx.scene.Scene;
7+
import javafx.scene.image.Image;
48
import javafx.stage.Stage;
59

10+
import java.io.IOException;
11+
612
/**
713
* @author Rocket
814
* @version 0.9.8
915
*/
1016
public class Launcher extends Application {
1117
@Override
1218
public void start(Stage primaryStage) {
13-
System.out.println("尚未完成,请等待未来版本发布");
14-
System.exit(0);
19+
FXMLLoader loader = new FXMLLoader(this.getClass().getResource(LocalURL.MAIN_FXML_PATH));
20+
Scene scene = null;
21+
try {
22+
scene = new Scene(loader.load());
23+
} catch (IOException e) {
24+
System.err.println("错误:" + e.getLocalizedMessage());
25+
System.exit(1);
26+
}
27+
primaryStage.setTitle("赋分程序");
28+
primaryStage.getIcons().add(new Image(LocalURL.ICON_PATH));
29+
primaryStage.setScene(scene);
30+
primaryStage.show();
1531
}
1632
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import com.jfoenix.controls.JFXProgressBar?>
4+
<?import javafx.scene.control.Label?>
5+
<?import javafx.scene.layout.*?>
6+
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="pane" prefHeight="400.0" prefWidth="600.0"
7+
stylesheets="@style.css" xmlns="http://javafx.com/javafx/8.0.171"
8+
fx:controller="cn.rocket.assaignmark.gui.Controller">
9+
<JFXProgressBar fx:id="progressBar" layoutX="46.0" layoutY="54.0" prefHeight="5.0" progress="0.21"
10+
style="-fx-background-color: dodgerblue;" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
11+
AnchorPane.topAnchor="0.0"/>
12+
<Label fx:id="progressLabel" alignment="CENTER" layoutX="281.0" layoutY="22.0" text="0/10"
13+
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="5.0"/>
14+
<Label fx:id="statusLabel" alignment="CENTER" layoutX="281.0" layoutY="32.0" text="正在初始化"
15+
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0"/>
16+
<Label layoutX="113.0" layoutY="99.0" text="Label"/>
17+
</AnchorPane>
7.94 MB
Binary file not shown.
6.76 KB
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@font-face{
2+
src: url('SYSans.otf');
3+
}
4+
5+
.root{
6+
-fx-font-family: "Source Han Sans CN Normal";
7+
-fx-font-size: 22;
8+
}
9+
10+
#statusLabel{
11+
-fx-font-size: 27;
12+
}

0 commit comments

Comments
 (0)