commit
a49c31586a
24
.idea/artifacts/JNotepad_jar.xml
generated
24
.idea/artifacts/JNotepad_jar.xml
generated
@ -1,24 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="JNotepad:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/JNotepad_jar</output-path>
|
||||
<root id="archive" name="JNotepad.jar">
|
||||
<element id="module-output" name="JNotepad" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/17.0.1/javafx-graphics-17.0.1-win.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-fxml/17.0.1/javafx-fxml-17.0.1-win.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-fxml/17.0.1/javafx-fxml-17.0.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-base/17.0.1/javafx-base-17.0.1-win.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/17.0.1/javafx-controls-17.0.1-win.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-base/17.0.1/javafx-base-17.0.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/17.0.1/javafx-controls-17.0.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/17.0.1/javafx-graphics-17.0.1.jar" path-in-jar="/" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-controls:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-controls:win:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:win:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-base:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-base:win:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:17.0.1" />
|
||||
<element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:win:17.0.1" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
68
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
68
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,68 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractClassShouldStartWithAbstractNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidApacheBeanUtilsCopy" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidCallStaticSimpleDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidCommentBehindStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidComplexCondition" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidConcurrentCompetitionRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidDoubleOrFloatEqualCompare" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidManuallyCreateThread" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidMissUseOfMathRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidNegationOperator" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidNewDateGetTime" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidPatternCompileInMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidReturnInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidStartWithDollarAndUnderLineNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidUseTimer" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaBigDecimalAvoidDoubleConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaBooleanPropertyShouldNotStartWithIs" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassCastExceptionWithSubListToArrayList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassCastExceptionWithToArray" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassMustHaveAuthor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassNamingShouldBeCamel" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCollectionInitShouldAssignCapacity" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCommentsMustBeJavadocFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaConcurrentExceptionWithModifyOriginSubList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaConstantFieldShouldBeUpperCase" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCountDownShouldInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaDontModifyInForeachCircle" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaEnumConstantsMustHaveComment" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaExceptionClassShouldEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaIbatisMethodQueryForList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaLockShouldWithTryFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaLowerCamelCaseVariableNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaMethodReturnWrapperType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaMethodTooLong" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPackageNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoMustOverrideToString" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoMustUsePrimitiveField" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoNoDefaultValue" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaRemoveCommentedCode" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaServiceOrDaoClassShouldEndWithImpl" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSneakyThrowsWithoutExceptionType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaStringConcat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSwitchExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaTestClassShouldEndWithTestNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadLocalShouldRemove" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadPoolCreation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadShouldSetName" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaTransactionMustHaveRollback" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUndefineMagicConstant" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -14,7 +14,7 @@
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17.0.2" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
6
pom.xml
6
pom.xml
@ -32,11 +32,15 @@
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.20</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
module org.jcnc.jnotepad {
|
||||
requires javafx.controls;
|
||||
requires atlantafx.base;
|
||||
requires cn.hutool;
|
||||
|
||||
exports org.jcnc.jnotepad;
|
||||
exports org.jcnc.jnotepad.tool;
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package org.jcnc.jnotepad.Interface;
|
||||
|
||||
/**
|
||||
* @author 一个大转盘
|
||||
* @date 2023/8/18
|
||||
*/
|
||||
public interface ShortcutKeyInterface {
|
||||
public void createShortcutKeyByConfig();
|
||||
|
||||
}
|
||||
@ -50,13 +50,13 @@ public class LunchApp extends Application {
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.getIcons().add(new Image(Objects.requireNonNull(getClass().getResource(icon)).toString()));
|
||||
primaryStage.show();
|
||||
|
||||
ViewManager viewManager = ViewManager.getInstance(scene);
|
||||
viewManager.initScreen(scene);
|
||||
|
||||
// 初始化菜单项和标签栏
|
||||
view.initItem();
|
||||
view.initTabPane();
|
||||
view.initShortcutKey();
|
||||
|
||||
if (isRelevance) {
|
||||
// 使用线程池加载关联文件并创建文本区域
|
||||
|
||||
@ -27,7 +27,10 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
|
||||
// 创建一个新的文本编辑区
|
||||
TextArea textArea = new TextArea();
|
||||
|
||||
textArea.setStyle(
|
||||
"-fx-border-color:white;" +
|
||||
"-fx-background-color:white"
|
||||
);
|
||||
// 创建一个新的Tab页
|
||||
Tab tab = new Tab("新建文本 " + ++ViewManager.tabIndex);
|
||||
tab.setContent(textArea);
|
||||
|
||||
@ -6,6 +6,8 @@ import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import org.jcnc.jnotepad.Interface.ControllerInterface;
|
||||
import org.jcnc.jnotepad.LunchApp;
|
||||
import org.jcnc.jnotepad.controller.event.handler.LineFeed;
|
||||
@ -158,6 +160,7 @@ public class Controller implements ControllerInterface {
|
||||
Tab tab = createNewTab(file.getName(), textArea);
|
||||
tab.setUserData(file);
|
||||
ViewManager.tabPane.getTabs().add(tab);
|
||||
// ViewManager.tabPane.sets
|
||||
ViewManager.tabPane.getSelectionModel().select(tab);
|
||||
updateStatusLabel(textArea);
|
||||
|
||||
@ -265,7 +268,12 @@ public class Controller implements ControllerInterface {
|
||||
* @return 新的文本区域
|
||||
*/
|
||||
private TextArea createNewTextArea() {
|
||||
return new TextArea();
|
||||
TextArea textArea = new TextArea();
|
||||
textArea.setStyle(
|
||||
"-fx-border-color:white;" +
|
||||
"-fx-background-color:white"
|
||||
);
|
||||
return textArea;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package org.jcnc.jnotepad.controller.manager;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import javafx.scene.control.Menu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import org.jcnc.jnotepad.Interface.ShortcutKeyInterface;
|
||||
import org.jcnc.jnotepad.tool.FileUtil;
|
||||
import org.jcnc.jnotepad.view.manager.ViewManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author 一个大转盘
|
||||
* @date 2023/8/18
|
||||
*/
|
||||
public class ShortcutKey implements ShortcutKeyInterface {
|
||||
@Override
|
||||
public void createShortcutKeyByConfig() {
|
||||
String json = "src/main/resources/config/shortcutKey.json";
|
||||
File jsonFile = new File(json);
|
||||
// 读取json文件
|
||||
String jsonData = FileUtil.getJsonStr(jsonFile);
|
||||
// 转json对象
|
||||
JSONObject shortcutKeyConfig = JSONUtil.parseObj(jsonData);
|
||||
for (Map.Entry<String, Object> stringObjectEntry : shortcutKeyConfig) {
|
||||
// 保证json的key必须和变量名一致
|
||||
MenuItem menuItem = ViewManager.itemMap.get(stringObjectEntry.getKey());
|
||||
String shortKeyValue = stringObjectEntry.getValue().toString();
|
||||
if (ObjectUtil.isNotEmpty(shortKeyValue)&&ObjectUtil.isNotEmpty(menuItem)) {
|
||||
// 动态添加快捷键
|
||||
menuItem.setAccelerator(KeyCombination.keyCombination(shortKeyValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
37
src/main/java/org/jcnc/jnotepad/tool/FileUtil.java
Normal file
37
src/main/java/org/jcnc/jnotepad/tool/FileUtil.java
Normal file
@ -0,0 +1,37 @@
|
||||
package org.jcnc.jnotepad.tool;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* @author 一个大转盘
|
||||
* @date 2023/8/18
|
||||
*/
|
||||
public class FileUtil {
|
||||
|
||||
/**
|
||||
* 把一个文件中的内容读取成一个String字符串
|
||||
* @date 2023/8/18 0:54
|
||||
* @param jsonFile
|
||||
* @return String
|
||||
*/
|
||||
public static String getJsonStr(File jsonFile){
|
||||
String jsonStr = "";
|
||||
try {
|
||||
FileReader fileReader = new FileReader(jsonFile);
|
||||
Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
|
||||
int ch = 0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
while ((ch = reader.read()) != -1) {
|
||||
sb.append((char) ch);
|
||||
}
|
||||
fileReader.close();
|
||||
reader.close();
|
||||
jsonStr = sb.toString();
|
||||
return jsonStr;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,27 +1,42 @@
|
||||
package org.jcnc.jnotepad.view.init;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import org.jcnc.jnotepad.controller.manager.Controller;
|
||||
import org.jcnc.jnotepad.controller.manager.ShortcutKey;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jcnc.jnotepad.view.manager.ViewManager.*;
|
||||
|
||||
|
||||
public class View {
|
||||
|
||||
private static Map<String, Object> itmeMap = new HashMap<>();
|
||||
|
||||
public void initItem() {
|
||||
// 初始化菜单项的事件处理器
|
||||
newItem.setOnAction(new Controller().getNewFileEventHandler(new TextArea()));
|
||||
openItem.setOnAction(new Controller().getOpenFileEventHandler());
|
||||
saveAsItem.setOnAction(new Controller().getSaveAsFileEventHandler());
|
||||
EventHandler<ActionEvent> newFileEventHandler = new Controller().getNewFileEventHandler(new TextArea());
|
||||
newItem.setOnAction(newFileEventHandler);
|
||||
EventHandler<ActionEvent> openFileEventHandler = new Controller().getOpenFileEventHandler();
|
||||
openItem.setOnAction(openFileEventHandler);
|
||||
EventHandler<ActionEvent> saveAsFileEventHandler = new Controller().getSaveAsFileEventHandler();
|
||||
saveAsItem.setOnAction(saveAsFileEventHandler);
|
||||
lineFeedItem.setOnAction(new Controller().getLineFeedEventHandler(new TextArea()));
|
||||
|
||||
}
|
||||
|
||||
public void initTabPane() {
|
||||
new Controller().initTabPane();
|
||||
}
|
||||
|
||||
|
||||
// 初始化快捷键
|
||||
public void initShortcutKey(){
|
||||
new ShortcutKey().createShortcutKeyByConfig();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,9 +3,13 @@ package org.jcnc.jnotepad.view.manager;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 该类管理记事本应用程序的视图组件。
|
||||
*/
|
||||
@ -20,7 +24,7 @@ public class ViewManager {
|
||||
// 菜单栏组件
|
||||
public static MenuBar menuBar; //菜单栏
|
||||
public static Menu fileMenu, setMenu, pluginMenu; //文件菜单//设置菜单//插件菜单 菜单
|
||||
public static MenuItem newItem, openItem, saveAsItem, addItem, coutItem; //新建/打开/保存/保存至//增加//查看 菜单按钮
|
||||
public static MenuItem newItem, openItem, saveAsItem, addItem, countItem; //新建/打开/保存/保存至//增加//查看 菜单按钮
|
||||
|
||||
public static CheckMenuItem lineFeedItem; //自动换行点击菜单按钮
|
||||
// 主界面布局
|
||||
@ -34,6 +38,8 @@ public class ViewManager {
|
||||
|
||||
private static ViewManager instance = null;
|
||||
|
||||
public static Map<String, MenuItem> itemMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 获取ViewManager的实例。如果实例不存在,则创建一个新实例。
|
||||
*
|
||||
@ -68,15 +74,23 @@ public class ViewManager {
|
||||
|
||||
//文件菜单
|
||||
fileMenu = new Menu("文件");
|
||||
|
||||
newItem = new MenuItem("新建");
|
||||
itemMap.put("newItem", newItem);
|
||||
|
||||
openItem = new MenuItem("打开");
|
||||
itemMap.put("openItem", openItem);
|
||||
|
||||
saveAsItem = new MenuItem("另存为");
|
||||
itemMap.put("saveAsItem", saveAsItem);
|
||||
|
||||
fileMenu.getItems().addAll(newItem, openItem, saveAsItem);
|
||||
|
||||
//设置菜单
|
||||
setMenu = new Menu("设置");
|
||||
|
||||
lineFeedItem = new CheckMenuItem("自动换行");
|
||||
itemMap.put("lineFeedItem", lineFeedItem);
|
||||
lineFeedItem.selectedProperty().set(true);
|
||||
|
||||
setMenu.getItems().addAll(lineFeedItem);
|
||||
@ -84,9 +98,12 @@ public class ViewManager {
|
||||
//插件菜单
|
||||
pluginMenu = new Menu("插件");
|
||||
addItem = new MenuItem("增加插件");
|
||||
coutItem = new MenuItem("统计字数");
|
||||
itemMap.put("addItem", addItem);
|
||||
|
||||
pluginMenu.getItems().addAll(addItem, coutItem);
|
||||
countItem = new MenuItem("统计字数");
|
||||
itemMap.put("countItem", countItem);
|
||||
|
||||
pluginMenu.getItems().addAll(addItem, countItem);
|
||||
|
||||
//菜单栏
|
||||
menuBar.getMenus().addAll(fileMenu, setMenu, pluginMenu);
|
||||
|
||||
10
src/main/resources/config/shortcutKey.json
Normal file
10
src/main/resources/config/shortcutKey.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"newItem": "ctrl+n",
|
||||
"openItem": "ctrl+o",
|
||||
"saveAsItem": "ctrl+shift+s",
|
||||
|
||||
"lineFeedItem": "",
|
||||
|
||||
"addItem": "",
|
||||
"countItem": ""
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user