增加设置按钮
This commit is contained in:
parent
43da503da9
commit
69922ea846
@ -20,10 +20,11 @@ module org.jcnc.jnotepad {
|
|||||||
exports org.jcnc.jnotepad.controller.manager;
|
exports org.jcnc.jnotepad.controller.manager;
|
||||||
exports org.jcnc.jnotepad.view.manager;
|
exports org.jcnc.jnotepad.view.manager;
|
||||||
exports org.jcnc.jnotepad.constants;
|
exports org.jcnc.jnotepad.constants;
|
||||||
exports org.jcnc.jnotepad.ui;
|
|
||||||
exports org.jcnc.jnotepad.controller.i18n;
|
exports org.jcnc.jnotepad.controller.i18n;
|
||||||
exports org.jcnc.jnotepad.ui.tab;
|
exports org.jcnc.jnotepad.ui.root.center.tab;
|
||||||
exports org.jcnc.jnotepad.ui.status;
|
exports org.jcnc.jnotepad.ui.root.bottom.status;
|
||||||
exports org.jcnc.jnotepad.ui.menu;
|
exports org.jcnc.jnotepad.ui.root.top.menu;
|
||||||
opens org.jcnc.jnotepad.app.config;
|
opens org.jcnc.jnotepad.app.config;
|
||||||
|
exports org.jcnc.jnotepad.ui.module;
|
||||||
|
exports org.jcnc.jnotepad.ui.root.top.tools;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package org.jcnc.jnotepad.Interface;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
|
||||||
|
|
||||||
|
public interface BorderPaneAble {
|
||||||
|
|
||||||
|
void setTopComponent(Node node);
|
||||||
|
|
||||||
|
void setBottomComponent(Node node);
|
||||||
|
|
||||||
|
void setLeftComponent(Node node);
|
||||||
|
|
||||||
|
void setRightComponent(Node node);
|
||||||
|
|
||||||
|
void setCenterComponent(Node node);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -7,7 +7,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author 许轲
|
* @author 许轲
|
||||||
*/
|
*/
|
||||||
public interface ControllerInterface {
|
public interface ControllerAble {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开关联文件并创建 TextArea
|
* 打开关联文件并创建 TextArea
|
||||||
12
src/main/java/org/jcnc/jnotepad/Interface/HBoxAble.java
Normal file
12
src/main/java/org/jcnc/jnotepad/Interface/HBoxAble.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package org.jcnc.jnotepad.Interface;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
|
||||||
|
public interface HBoxAble {
|
||||||
|
|
||||||
|
void addChild(Node node);
|
||||||
|
|
||||||
|
void addChild(Node... nodes);
|
||||||
|
HBox getHBox();
|
||||||
|
}
|
||||||
13
src/main/java/org/jcnc/jnotepad/Interface/VBoxAble.java
Normal file
13
src/main/java/org/jcnc/jnotepad/Interface/VBoxAble.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package org.jcnc.jnotepad.Interface;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
|
||||||
|
public interface VBoxAble {
|
||||||
|
void addChild(Node node);
|
||||||
|
|
||||||
|
void addChild(Node... nodes);
|
||||||
|
|
||||||
|
VBox getVBox();
|
||||||
|
}
|
||||||
@ -5,8 +5,8 @@ import javafx.event.EventHandler;
|
|||||||
import org.jcnc.jnotepad.app.i18n.UIResourceBundle;
|
import org.jcnc.jnotepad.app.i18n.UIResourceBundle;
|
||||||
import org.jcnc.jnotepad.constants.TextConstants;
|
import org.jcnc.jnotepad.constants.TextConstants;
|
||||||
import org.jcnc.jnotepad.tool.UiUtil;
|
import org.jcnc.jnotepad.tool.UiUtil;
|
||||||
import org.jcnc.jnotepad.ui.LineNumberTextArea;
|
import org.jcnc.jnotepad.ui.module.LineNumberTextArea;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
import org.jcnc.jnotepad.view.manager.ViewManager;
|
import org.jcnc.jnotepad.view.manager.ViewManager;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import org.jcnc.jnotepad.manager.ThreadPoolManager;
|
|||||||
import org.jcnc.jnotepad.tool.EncodingDetector;
|
import org.jcnc.jnotepad.tool.EncodingDetector;
|
||||||
import org.jcnc.jnotepad.tool.LogUtil;
|
import org.jcnc.jnotepad.tool.LogUtil;
|
||||||
import org.jcnc.jnotepad.tool.UiUtil;
|
import org.jcnc.jnotepad.tool.UiUtil;
|
||||||
import org.jcnc.jnotepad.ui.LineNumberTextArea;
|
import org.jcnc.jnotepad.ui.module.LineNumberTextArea;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import javafx.scene.input.KeyCode;
|
|||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import org.jcnc.jnotepad.tool.LogUtil;
|
import org.jcnc.jnotepad.tool.LogUtil;
|
||||||
import org.jcnc.jnotepad.tool.UiUtil;
|
import org.jcnc.jnotepad.tool.UiUtil;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import org.jcnc.jnotepad.controller.config.AppConfigController;
|
|||||||
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
||||||
import org.jcnc.jnotepad.tool.LogUtil;
|
import org.jcnc.jnotepad.tool.LogUtil;
|
||||||
import org.jcnc.jnotepad.tool.UiUtil;
|
import org.jcnc.jnotepad.tool.UiUtil;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package org.jcnc.jnotepad.controller.manager;
|
package org.jcnc.jnotepad.controller.manager;
|
||||||
|
|
||||||
import org.jcnc.jnotepad.Interface.ControllerInterface;
|
import org.jcnc.jnotepad.Interface.ControllerAble;
|
||||||
import org.jcnc.jnotepad.controller.event.handler.NewFile;
|
import org.jcnc.jnotepad.controller.event.handler.NewFile;
|
||||||
import org.jcnc.jnotepad.controller.event.handler.OpenFile;
|
import org.jcnc.jnotepad.controller.event.handler.OpenFile;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author 许轲
|
* @author 许轲
|
||||||
*/
|
*/
|
||||||
public class Controller implements ControllerInterface {
|
public class Controller implements ControllerAble {
|
||||||
|
|
||||||
private static final Controller INSTANCE = new Controller();
|
private static final Controller INSTANCE = new Controller();
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package org.jcnc.jnotepad.tool;
|
package org.jcnc.jnotepad.tool;
|
||||||
|
|
||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
import org.jcnc.jnotepad.ui.menu.JNotepadMenuBar;
|
import org.jcnc.jnotepad.ui.root.top.menu.JNotepadMenuBar;
|
||||||
import org.jcnc.jnotepad.ui.status.JNotepadStatusBox;
|
import org.jcnc.jnotepad.ui.root.bottom.status.JNotepadStatusBox;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTabPane;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane;
|
||||||
import org.jcnc.jnotepad.view.manager.ViewManager;
|
import org.jcnc.jnotepad.view.manager.ViewManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,12 +32,12 @@ public class UiUtil {
|
|||||||
/**
|
/**
|
||||||
* 菜单栏组件
|
* 菜单栏组件
|
||||||
*/
|
*/
|
||||||
private static final JNotepadMenuBar MENU_BAR = JNotepadMenuBar.getMenuBar();
|
private static final JNotepadMenuBar MENU_BAR = JNotepadMenuBar.getInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取标签页布局组件
|
* 获取标签页布局组件
|
||||||
*
|
*
|
||||||
* @return org.jcnc.jnotepad.ui.tab.JNotepadTabPane
|
* @return org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane
|
||||||
* @apiNote JNotepadTabPane.getInstance()
|
* @apiNote JNotepadTabPane.getInstance()
|
||||||
* @see JNotepadTabPane
|
* @see JNotepadTabPane
|
||||||
*/
|
*/
|
||||||
@ -49,7 +49,7 @@ public class UiUtil {
|
|||||||
/**
|
/**
|
||||||
* 获取标签页组件
|
* 获取标签页组件
|
||||||
*
|
*
|
||||||
* @return org.jcnc.jnotepad.ui.tab.JNotepadTab
|
* @return org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab
|
||||||
* @apiNote JNotepadTabPane.getInstance().getSelected()<br>获取当前选中的标签页
|
* @apiNote JNotepadTabPane.getInstance().getSelected()<br>获取当前选中的标签页
|
||||||
* @see JNotepadTabPane
|
* @see JNotepadTabPane
|
||||||
*/
|
*/
|
||||||
@ -83,7 +83,7 @@ public class UiUtil {
|
|||||||
/**
|
/**
|
||||||
* 获取状态栏组件
|
* 获取状态栏组件
|
||||||
*
|
*
|
||||||
* @return org.jcnc.jnotepad.ui.status.JNotepadStatusBox
|
* @return org.jcnc.jnotepad.ui.root.bottom.status.JNotepadStatusBox
|
||||||
* @since 2023/8/29 14:14
|
* @since 2023/8/29 14:14
|
||||||
*/
|
*/
|
||||||
public static JNotepadStatusBox getStatusBox() {
|
public static JNotepadStatusBox getStatusBox() {
|
||||||
@ -93,7 +93,7 @@ public class UiUtil {
|
|||||||
/**
|
/**
|
||||||
* 获取菜单栏组件
|
* 获取菜单栏组件
|
||||||
*
|
*
|
||||||
* @return org.jcnc.jnotepad.ui.menu.JNotepadMenuBar
|
* @return org.jcnc.jnotepad.ui.root.top.menu.JNotepadMenuBar
|
||||||
* @since 2023/8/29 14:15
|
* @since 2023/8/29 14:15
|
||||||
*/
|
*/
|
||||||
public static JNotepadMenuBar getMenuBar() {
|
public static JNotepadMenuBar getMenuBar() {
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.module;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import org.jcnc.jnotepad.Interface.BorderPaneAble;
|
||||||
|
|
||||||
|
public abstract class AbstractBorderPane extends BorderPane implements BorderPaneAble {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTopComponent(Node node) {
|
||||||
|
setTop(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBottomComponent(Node node) {
|
||||||
|
setBottom(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLeftComponent(Node node) {
|
||||||
|
setLeft(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRightComponent(Node node) {
|
||||||
|
setRight(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCenterComponent(Node node) {
|
||||||
|
setCenter(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
28
src/main/java/org/jcnc/jnotepad/ui/module/AbstractHBox.java
Normal file
28
src/main/java/org/jcnc/jnotepad/ui/module/AbstractHBox.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.module;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import org.jcnc.jnotepad.Interface.HBoxAble;
|
||||||
|
|
||||||
|
public abstract class AbstractHBox extends HBox implements HBoxAble {
|
||||||
|
private final HBox hBox;
|
||||||
|
|
||||||
|
public AbstractHBox() {
|
||||||
|
hBox = new HBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChild(Node node) {
|
||||||
|
hBox.getChildren().add(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChild(Node... nodes) {
|
||||||
|
hBox.getChildren().addAll(nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HBox getHBox() {
|
||||||
|
return hBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
29
src/main/java/org/jcnc/jnotepad/ui/module/AbstractVBox.java
Normal file
29
src/main/java/org/jcnc/jnotepad/ui/module/AbstractVBox.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.module;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import org.jcnc.jnotepad.Interface.VBoxAble;
|
||||||
|
|
||||||
|
public abstract class AbstractVBox extends VBox implements VBoxAble {
|
||||||
|
|
||||||
|
private final VBox vBox;
|
||||||
|
|
||||||
|
public AbstractVBox() {
|
||||||
|
vBox = new VBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChild(Node node) {
|
||||||
|
vBox.getChildren().add(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChild(Node... nodes) {
|
||||||
|
vBox.getChildren().addAll(nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VBox getVBox() {
|
||||||
|
return vBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,13 @@
|
|||||||
package org.jcnc.jnotepad.ui;
|
package org.jcnc.jnotepad.ui.module;
|
||||||
|
|
||||||
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.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.status.JNotepadStatusBox;
|
import org.jcnc.jnotepad.ui.root.bottom.status.JNotepadStatusBox;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTabPane;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -1,13 +1,13 @@
|
|||||||
package org.jcnc.jnotepad.ui.status;
|
package org.jcnc.jnotepad.ui.root.bottom.status;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
import javafx.scene.layout.HBox;
|
|
||||||
import org.jcnc.jnotepad.app.i18n.UIResourceBundle;
|
import org.jcnc.jnotepad.app.i18n.UIResourceBundle;
|
||||||
import org.jcnc.jnotepad.constants.TextConstants;
|
import org.jcnc.jnotepad.constants.TextConstants;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.module.AbstractHBox;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTabPane;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ import java.nio.charset.Charset;
|
|||||||
*
|
*
|
||||||
* @author songdragon
|
* @author songdragon
|
||||||
*/
|
*/
|
||||||
public class JNotepadStatusBox extends HBox {
|
public class JNotepadStatusBox extends AbstractHBox {
|
||||||
|
|
||||||
private static final JNotepadStatusBox STATUS_BOX = new JNotepadStatusBox();
|
private static final JNotepadStatusBox STATUS_BOX = new JNotepadStatusBox();
|
||||||
/**
|
/**
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package org.jcnc.jnotepad.ui.tab;
|
package org.jcnc.jnotepad.ui.root.center.tab;
|
||||||
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import org.jcnc.jnotepad.controller.config.AppConfigController;
|
import org.jcnc.jnotepad.controller.config.AppConfigController;
|
||||||
import org.jcnc.jnotepad.ui.LineNumberTextArea;
|
import org.jcnc.jnotepad.ui.module.LineNumberTextArea;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package org.jcnc.jnotepad.ui.tab;
|
package org.jcnc.jnotepad.ui.root.center.tab;
|
||||||
|
|
||||||
import javafx.scene.control.TabPane;
|
import javafx.scene.control.TabPane;
|
||||||
import org.jcnc.jnotepad.controller.config.AppConfigController;
|
import org.jcnc.jnotepad.controller.config.AppConfigController;
|
||||||
21
src/main/java/org/jcnc/jnotepad/ui/root/top/RootTopVBox.java
Normal file
21
src/main/java/org/jcnc/jnotepad/ui/root/top/RootTopVBox.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.root.top;
|
||||||
|
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import org.jcnc.jnotepad.ui.root.top.menu.JNotepadMenuBar;
|
||||||
|
import org.jcnc.jnotepad.ui.root.top.tools.ToolBorderPane;
|
||||||
|
import org.jcnc.jnotepad.ui.root.top.tools.ToolHBox;
|
||||||
|
|
||||||
|
public class RootTopVBox extends VBox {
|
||||||
|
private static final RootTopVBox INSTANCE = new RootTopVBox();
|
||||||
|
|
||||||
|
private RootTopVBox() {
|
||||||
|
// 在构造函数中初始化
|
||||||
|
getChildren().add(JNotepadMenuBar.getInstance());
|
||||||
|
getChildren().add(ToolBorderPane.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RootTopVBox getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package org.jcnc.jnotepad.ui.menu;
|
package org.jcnc.jnotepad.ui.root.top.menu;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
@ -10,8 +10,8 @@ import org.jcnc.jnotepad.controller.config.AppConfigController;
|
|||||||
import org.jcnc.jnotepad.controller.event.handler.*;
|
import org.jcnc.jnotepad.controller.event.handler.*;
|
||||||
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
||||||
import org.jcnc.jnotepad.tool.LogUtil;
|
import org.jcnc.jnotepad.tool.LogUtil;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTabPane;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -264,7 +264,7 @@ public class JNotepadMenuBar extends MenuBar {
|
|||||||
pluginMenu.getItems().addAll(addItem, countItem);
|
pluginMenu.getItems().addAll(addItem, countItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JNotepadMenuBar getMenuBar() {
|
public static JNotepadMenuBar getInstance() {
|
||||||
return MENU_BAR;
|
return MENU_BAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.root.top.tools;
|
||||||
|
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ToolBar;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.layout.Priority;
|
||||||
|
|
||||||
|
import static javafx.scene.layout.HBox.setHgrow;
|
||||||
|
|
||||||
|
public class JNotepadToolBar extends ToolBar {
|
||||||
|
private static final JNotepadToolBar INSTANCE = new JNotepadToolBar();
|
||||||
|
private JNotepadToolBar() {
|
||||||
|
// 创建工具栏上的按钮
|
||||||
|
Image image = new Image("tools.png"); // 替换为你的图片文件路径
|
||||||
|
ImageView imageView = new ImageView(image);
|
||||||
|
imageView.setFitWidth(10);
|
||||||
|
imageView.setFitHeight(10);
|
||||||
|
imageView.setScaleX(2.5); // 设置水平缩放比例
|
||||||
|
imageView.setScaleY(2.5); // 设置垂直缩放比例
|
||||||
|
// 设置缩放比例
|
||||||
|
Button setButton = new Button();
|
||||||
|
setButton.setGraphic(imageView);
|
||||||
|
|
||||||
|
// 将按钮添加到工具栏
|
||||||
|
getItems().addAll(setButton);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JNotepadToolBar getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.root.top.tools;
|
||||||
|
|
||||||
|
import org.jcnc.jnotepad.ui.module.AbstractBorderPane;
|
||||||
|
import org.jcnc.jnotepad.ui.root.top.menu.JNotepadMenuBar;
|
||||||
|
|
||||||
|
public class ToolBorderPane extends AbstractBorderPane {
|
||||||
|
|
||||||
|
private static final ToolBorderPane ToolBorderPane = new ToolBorderPane();
|
||||||
|
|
||||||
|
public ToolBorderPane() {
|
||||||
|
|
||||||
|
setRightComponent(ToolHBox.getInstance());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ToolBorderPane getInstance() {
|
||||||
|
return ToolBorderPane;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package org.jcnc.jnotepad.ui.root.top.tools;
|
||||||
|
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.Priority;
|
||||||
|
|
||||||
|
public class ToolHBox extends HBox {
|
||||||
|
private static final ToolHBox INSTANCE = new ToolHBox();
|
||||||
|
|
||||||
|
|
||||||
|
private ToolHBox() {
|
||||||
|
setHgrow(this, Priority.ALWAYS);
|
||||||
|
|
||||||
|
HBox.setHgrow(JNotepadToolBar.getInstance(), Priority.ALWAYS); // 设置子节点水平拉伸
|
||||||
|
|
||||||
|
getChildren().add(JNotepadToolBar.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ToolHBox getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -3,9 +3,9 @@ package org.jcnc.jnotepad.view.manager;
|
|||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import org.jcnc.jnotepad.exception.AppException;
|
import org.jcnc.jnotepad.exception.AppException;
|
||||||
import org.jcnc.jnotepad.ui.menu.JNotepadMenuBar;
|
import org.jcnc.jnotepad.ui.root.top.RootTopVBox;
|
||||||
import org.jcnc.jnotepad.ui.status.JNotepadStatusBox;
|
import org.jcnc.jnotepad.ui.root.bottom.status.JNotepadStatusBox;
|
||||||
import org.jcnc.jnotepad.ui.tab.JNotepadTabPane;
|
import org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,7 +78,8 @@ public class ViewManager {
|
|||||||
|
|
||||||
// 创建主界面布局
|
// 创建主界面布局
|
||||||
root = new BorderPane();
|
root = new BorderPane();
|
||||||
root.setTop(JNotepadMenuBar.getMenuBar());
|
|
||||||
|
root.setTop(RootTopVBox.getInstance());
|
||||||
|
|
||||||
// 创建标签页和文本编辑区域
|
// 创建标签页和文本编辑区域
|
||||||
root.setCenter(JNotepadTabPane.getInstance());
|
root.setCenter(JNotepadTabPane.getInstance());
|
||||||
|
|||||||
BIN
src/main/resources/tools.gif
Normal file
BIN
src/main/resources/tools.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
BIN
src/main/resources/tools.png
Normal file
BIN
src/main/resources/tools.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
x
Reference in New Issue
Block a user