Skip to content

Commit 8b742f8

Browse files
committed
添加主界面菜单
1 parent 32e698d commit 8b742f8

5 files changed

Lines changed: 41 additions & 26 deletions

File tree

src/main/java/com/xwintop/xJavaFxTool/controller/IndexController.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.xwintop.xJavaFxTool.model.ToolFxmlLoaderConfiguration;
55
import com.xwintop.xJavaFxTool.services.IndexService;
66
import com.xwintop.xJavaFxTool.utils.Config;
7+
import com.xwintop.xJavaFxTool.utils.ConfigureUtil;
78
import com.xwintop.xJavaFxTool.utils.JavaFxViewUtil;
89
import com.xwintop.xJavaFxTool.utils.XJavaFxSystemUtil;
910
import com.xwintop.xJavaFxTool.view.IndexView;
@@ -26,13 +27,10 @@
2627
import javafx.stage.Stage;
2728
import lombok.extern.slf4j.Slf4j;
2829
import org.apache.commons.lang.StringUtils;
29-
import org.apache.log4j.Logger;
30+
import org.apache.commons.lang3.time.DateFormatUtils;
3031

3132
import java.net.URL;
32-
import java.util.HashMap;
33-
import java.util.List;
34-
import java.util.Map;
35-
import java.util.ResourceBundle;
33+
import java.util.*;
3634

3735
/**
3836
* @ClassName: IndexController
@@ -301,6 +299,21 @@ private void setLanguageAction(ActionEvent event) throws Exception {
301299
indexService.setLanguageAction(menuItem.getText());
302300
}
303301

302+
@FXML
303+
private void openLogFile(ActionEvent event) throws Exception {
304+
String filePath = "logs/logFile." + DateFormatUtils.format(new Date(), "yyyy-MM-dd") + ".log";
305+
XJavaFxSystemUtil.openDirectory(filePath);
306+
}
307+
308+
@FXML
309+
private void openLogFolder(ActionEvent event) throws Exception {
310+
XJavaFxSystemUtil.openDirectory("logs/");
311+
}
312+
@FXML
313+
private void openConfigFolder(ActionEvent event) throws Exception {
314+
XJavaFxSystemUtil.openDirectory(ConfigureUtil.getConfigurePath());
315+
}
316+
304317
@FXML
305318
private void xwintopLinkOnAction(ActionEvent event) throws Exception {
306319
HttpClientUtil.openBrowseURLThrowsException("https://gitee.com/xwintop/xJavaFxTool");

src/main/java/com/xwintop/xJavaFxTool/utils/ConfigureUtil.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
import java.io.File;
44

55
public class ConfigureUtil {
6-
public static String getConfigurePath() {
7-
return System.getProperty("user.home") + "/xJavaFxTool/";
8-
}
6+
public static String getConfigurePath() {
7+
return System.getProperty("user.home") + "/xJavaFxTool/";
8+
}
99

10-
public static String getConfigurePath(String fileName) {
11-
return System.getProperty("user.home") + "/xJavaFxTool/" + fileName;
12-
}
10+
public static String getConfigurePath(String fileName) {
11+
return getConfigurePath() + fileName;
12+
}
1313

14-
public static File getConfigureFile(String fileName) {
15-
return new File(getConfigurePath(fileName));
16-
}
14+
public static File getConfigureFile(String fileName) {
15+
return new File(getConfigurePath(fileName));
16+
}
1717
}

src/main/resources/com/xwintop/xJavaFxTool/fxmlView/Index.fxml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<?import javafx.geometry.Insets?>
4-
<?import javafx.scene.control.Button?>
5-
<?import javafx.scene.control.CheckBox?>
6-
<?import javafx.scene.control.Hyperlink?>
7-
<?import javafx.scene.control.Menu?>
8-
<?import javafx.scene.control.MenuBar?>
9-
<?import javafx.scene.control.MenuItem?>
10-
<?import javafx.scene.control.TabPane?>
11-
<?import javafx.scene.control.TextField?>
12-
<?import javafx.scene.layout.AnchorPane?>
13-
<?import javafx.scene.layout.BorderPane?>
14-
<?import javafx.scene.layout.HBox?>
15-
4+
<?import javafx.scene.control.*?>
5+
<?import javafx.scene.layout.*?>
166
<AnchorPane prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.xwintop.xJavaFxTool.controller.IndexController">
177
<children>
188
<BorderPane layoutY="2.0" prefHeight="600.0" prefWidth="900.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="2.0">
@@ -27,20 +17,26 @@
2717
<MenuItem mnemonicParsing="false" onAction="#openAllTabAction" text="%openAllTab" />
2818
<MenuItem mnemonicParsing="false" onAction="#addNodepadAction" text="%addNodepad" />
2919
<MenuItem mnemonicParsing="false" onAction="#addLogConsoleAction" text="%addLogConsole" />
20+
<SeparatorMenuItem/>
3021
<MenuItem mnemonicParsing="false" onAction="#exitAction" text="%Exit" />
3122
</items>
3223
</Menu>
3324
<Menu fx:id="toolsMenu" mnemonicParsing="false" text="%Tools" />
3425
<Menu fx:id="moreToolsMenu" mnemonicParsing="false" text="%More_Tools" />
3526
<Menu fx:id="netWorkToolsMenu" mnemonicParsing="false" text="%NetWork_Tools" />
3627
<Menu fx:id="helpMenu" mnemonicParsing="false" text="%Help">
28+
<MenuItem mnemonicParsing="false" onAction="#openLogFile" text="%openLogFile" />
29+
<MenuItem mnemonicParsing="false" onAction="#openLogFolder" text="%openLogFolder" />
30+
<MenuItem mnemonicParsing="false" onAction="#openConfigFolder" text="%openConfigFolder" />
31+
<SeparatorMenuItem/>
3732
<items>
3833
<Menu mnemonicParsing="false" text="%SetLanguage">
3934
<items>
4035
<MenuItem mnemonicParsing="false" onAction="#setLanguageAction" text="简体中文" />
4136
<MenuItem mnemonicParsing="false" onAction="#setLanguageAction" text="English" />
4237
</items>
4338
</Menu>
39+
<SeparatorMenuItem/>
4440
<MenuItem mnemonicParsing="false" onAction="#aboutAction" text="%About" />
4541
</items>
4642
</Menu>

src/main/resources/locale/Menu.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ NetWork_Tools=\u7F51\u9875\u5DE5\u5177
1414
Help=\u5E2E\u52A9
1515
About=\u5173\u4E8E
1616
SetLanguage=\u8BBE\u7F6E\u8BED\u8A00
17+
openLogFile=\u6253\u5F00\u65E5\u5FD7\u6587\u4EF6
18+
openLogFolder=\u6253\u5F00\u65E5\u5FD7\u76EE\u5F55
19+
openConfigFolder=\u6253\u5F00\u914D\u7F6E\u76EE\u5F55
1720

1821
aboutText=\u6B22\u8FCE\u4F7F\u7528JavaFx\u5DE5\u5177\u96C6\u5408\u3002\ngit\u5730\u5740\uFF1Ahttps://gitee.com/xwintop/xJavaFxTool\n\u4F5C\u8005\uFF1A\u8FFD\u98CE\n\u535A\u5BA2\uFF1Awww.xwintop.com\n\u6B22\u8FCE\u524D\u6765\u63D0\u51FA\u610F\u89C1\uFF0C\u4E00\u8D77\u5B8C\u5584\u8BE5\u5DE5\u5177\uFF0C\u8C22\u8C22\uFF01\uFF01\n\u5F53\u524D\u7248\u672C\uFF1A
1922
SetLanguageText=\u8BED\u8A00\u9009\u62E9\u8BBE\u7F6E\u6210\u529F\uFF0C\u91CD\u542F\u540E\u751F\u6548\u3002

src/main/resources/locale/Menu_en_US.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ NetWork_Tools=NetWork Tools
1414
Help=Help
1515
About=About
1616
SetLanguage=SetLanguage
17+
openLogFile=openLogFile
18+
openLogFolder=openLogFolder
19+
openConfigFolder=openConfigFolder
1720

1821
aboutText=Welcome to the JavaFx tool set.\ngitUrl:https://gitee.com/xwintop/xJavaFxTool\nAuthor:xwintop\nblog:www.xwintop.com\nWelcome to make comments and improve the tool together. Thank you!!\ncurrent version:
1922
SetLanguageText=The language selection settings have been successful and will take effect after reboot.

0 commit comments

Comments
 (0)