💡 添加或修改源代码注释️ 优化代码逻辑

This commit is contained in:
gewuyou 2023-08-28 23:38:08 +08:00
parent 422bb59161
commit 8f4448bac2
6 changed files with 7 additions and 12 deletions

View File

@ -42,7 +42,7 @@ public class LunchApp extends Application {
scene = new Scene(root, width, length); scene = new Scene(root, width, length);
Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet()); Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("/css/styles.css")).toExternalForm()); scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("/css/styles.css")).toExternalForm());
initUIComponents(); initUiComponents();
UIResourceBundle.bindStringProperty(primaryStage.titleProperty(), TextConstants.TITLE); UIResourceBundle.bindStringProperty(primaryStage.titleProperty(), TextConstants.TITLE);
@ -53,7 +53,7 @@ public class LunchApp extends Application {
primaryStage.show(); primaryStage.show();
} }
private void initUIComponents() { private void initUiComponents() {
//1. 加载语言 //1. 加载语言
LocalizationController.initLocal(); LocalizationController.initLocal();

View File

@ -36,7 +36,6 @@ public class OpenFile implements EventHandler<ActionEvent> {
*/ */
@Override @Override
public void handle(ActionEvent event) { public void handle(ActionEvent event) {
// 创建文件选择器 // 创建文件选择器
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
// 显示文件选择对话框并获取选中的文件 // 显示文件选择对话框并获取选中的文件

View File

@ -13,8 +13,8 @@ import static org.jcnc.jnotepad.constants.TextConstants.CHINESE;
import static org.jcnc.jnotepad.constants.TextConstants.ENGLISH; import static org.jcnc.jnotepad.constants.TextConstants.ENGLISH;
/** /**
* 本地化配置文件<br> * 本地化控制器<br>
* 注意该配置文件必须先于快捷键配置文件加载 * 注意本地化配置加载应当优先于快捷键配置加载
* *
* @author gewuyou * @author gewuyou
* @see LunchApp * @see LunchApp

View File

@ -3,10 +3,8 @@ package org.jcnc.jnotepad.ui;
import javafx.beans.property.StringProperty; import javafx.beans.property.StringProperty;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import org.jcnc.jnotepad.app.config.AppConfig;
import org.jcnc.jnotepad.controller.config.AppConfigController; import org.jcnc.jnotepad.controller.config.AppConfigController;
import org.jcnc.jnotepad.tool.LogUtil; import org.jcnc.jnotepad.tool.LogUtil;
import org.jcnc.jnotepad.ui.menu.JNotepadMenuBar;
import org.jcnc.jnotepad.ui.status.JNotepadStatusBox; import org.jcnc.jnotepad.ui.status.JNotepadStatusBox;
import org.jcnc.jnotepad.ui.tab.JNotepadTab; import org.jcnc.jnotepad.ui.tab.JNotepadTab;
import org.jcnc.jnotepad.ui.tab.JNotepadTabPane; import org.jcnc.jnotepad.ui.tab.JNotepadTabPane;

View File

@ -145,11 +145,8 @@ public class JNotepadMenuBar extends MenuBar {
for (AppConfig.ShortcutKey shortcutKey : shortcutKeyConfigs) { for (AppConfig.ShortcutKey shortcutKey : shortcutKeyConfigs) {
// 保证json的key必须和变量名一致 // 保证json的key必须和变量名一致
MenuItem menuItem = this.itemMap.get(shortcutKey.getButtonName()); MenuItem menuItem = this.itemMap.get(shortcutKey.getButtonName());
if (Objects.isNull(menuItem)) {
continue;
}
String shortKeyValue = shortcutKey.getShortcutKeyValue(); String shortKeyValue = shortcutKey.getShortcutKeyValue();
if ("".equals(shortKeyValue)) { if (Objects.isNull(menuItem) || "".equals(shortKeyValue)) {
continue; continue;
} }
logger.info("功能名称:{}->快捷键:{}", menuItem.getText(), shortKeyValue); logger.info("功能名称:{}->快捷键:{}", menuItem.getText(), shortKeyValue);
@ -290,6 +287,7 @@ public class JNotepadMenuBar extends MenuBar {
/** /**
* 切换语言 * 切换语言
*
* @param actionEvent 点击事件 * @param actionEvent 点击事件
*/ */
private void toggleLanguage(ActionEvent actionEvent) { private void toggleLanguage(ActionEvent actionEvent) {

View File

@ -10,7 +10,7 @@
<property name="log.maxHistory" value="30"/> <property name="log.maxHistory" value="30"/>
<!-- 日志存储路径 --> <!-- 日志存储路径 -->
<property name="log.filePath" value="logs"/> <property name="log.filePath" value="logs"/>
<!--发布0时,请使用下方的路径--> <!--发布时,请使用下方的路径-->
<!--<property name="log.filePath" value="${user.home}/.jnotepad/logs"/>--> <!--<property name="log.filePath" value="${user.home}/.jnotepad/logs"/>-->
<!-- 日志的显式格式 --> <!-- 日志的显式格式 -->
<property name="log.pattern" <property name="log.pattern"