重构代码结构
This commit is contained in:
parent
76dc73da84
commit
571b8dd56a
@ -5,7 +5,6 @@ package org.jcnc.jnotepad;
|
||||
*/
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final double SCREEN_WIDTH = 800; //宽度
|
||||
public static final double SCREEN_LENGTH = 600; //高度
|
||||
public static final String APP_NAME = "JNotepad"; //名字
|
||||
|
||||
@ -16,14 +16,17 @@ import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static org.jcnc.jnotepad.view.View.initItem;
|
||||
import static org.jcnc.jnotepad.view.View.initTabPane;
|
||||
|
||||
public class LunchApp extends Application {
|
||||
private static final ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
public static boolean isRelevance = true;
|
||||
|
||||
Controller controller = new Controller();
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
View view=new View();
|
||||
Pane root = new Pane();
|
||||
|
||||
double width = Constants.SCREEN_WIDTH;
|
||||
@ -44,8 +47,8 @@ public class LunchApp extends Application {
|
||||
viewManager.initScreen(scene);
|
||||
|
||||
// 初始化菜单项和标签栏
|
||||
view.initItem();
|
||||
View.initTabPane();
|
||||
initItem();
|
||||
initTabPane();
|
||||
|
||||
if (isRelevance) {
|
||||
// 使用线程池加载关联文件并创建文本区域
|
||||
|
||||
@ -127,7 +127,7 @@ public class Controller implements ControllerInterface {
|
||||
autoSave(textArea);
|
||||
});
|
||||
} catch (IOException ignored) {
|
||||
// 适当地处理异常
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ public class LineFeedEventHandler implements EventHandler<ActionEvent> {
|
||||
public LineFeedEventHandler(TextArea textArea) {
|
||||
this.textArea = textArea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
String text = textArea.getText();
|
||||
|
||||
@ -9,11 +9,6 @@ import org.jcnc.jnotepad.ViewManager;
|
||||
import static org.jcnc.jnotepad.ViewManager.tabPane;
|
||||
|
||||
public class NewFileEventHandler implements EventHandler<ActionEvent> {
|
||||
|
||||
|
||||
public NewFileEventHandler() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
Controller controller = new Controller();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.jcnc.jnotepad.tool;
|
||||
|
||||
import javafx.scene.control.TextArea;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user