♻️ 重构代码 重构样式
This commit is contained in:
parent
46d859ef30
commit
bd3bff528c
@ -16,6 +16,7 @@ module org.jcnc.jnotepad {
|
||||
requires org.kordamp.ikonli.javafx;
|
||||
requires org.kordamp.ikonli.antdesignicons;
|
||||
requires org.fxmisc.richtext;
|
||||
requires org.fxmisc.flowless;
|
||||
exports org.jcnc.jnotepad;
|
||||
exports org.jcnc.jnotepad.model.enums;
|
||||
exports org.jcnc.jnotepad.app.config;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package org.jcnc.jnotepad.ui.module;
|
||||
|
||||
import org.fxmisc.richtext.CodeArea;
|
||||
import org.fxmisc.richtext.LineNumberFactory;
|
||||
import org.fxmisc.richtext.StyleClassedTextArea;
|
||||
import org.jcnc.jnotepad.util.LogUtil;
|
||||
import org.jcnc.jnotepad.views.root.center.main.bottom.status.BottomStatusBox;
|
||||
import org.jcnc.jnotepad.views.root.center.main.center.tab.CenterTab;
|
||||
@ -20,7 +20,7 @@ import java.io.IOException;
|
||||
*
|
||||
* @author luke
|
||||
*/
|
||||
public class LineNumberTextArea extends CodeArea {
|
||||
public class LineNumberTextArea extends StyleClassedTextArea {
|
||||
|
||||
|
||||
/**
|
||||
@ -35,10 +35,7 @@ public class LineNumberTextArea extends CodeArea {
|
||||
*/
|
||||
public LineNumberTextArea() {
|
||||
// 设置 LineNumberTextArea 的样式,包括边框和背景颜色
|
||||
this.setStyle(
|
||||
"-fx-border-color:white;" +
|
||||
"-fx-background-color:white"
|
||||
);
|
||||
getStyleClass().add("line-number-text-area");
|
||||
this.setParagraphGraphicFactory(LineNumberFactory.get(this));
|
||||
initListeners();
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.jcnc.jnotepad.views.root.center.main.center.tab;
|
||||
|
||||
import javafx.scene.control.Tab;
|
||||
import org.fxmisc.flowless.VirtualizedScrollPane;
|
||||
import org.jcnc.jnotepad.controller.config.AppConfigController;
|
||||
import org.jcnc.jnotepad.ui.module.LineNumberTextArea;
|
||||
|
||||
@ -37,7 +38,7 @@ public class CenterTab extends Tab {
|
||||
public CenterTab(String tabTitle, LineNumberTextArea textArea, Charset charset) {
|
||||
super(tabTitle);
|
||||
lineNumberTextArea = textArea;
|
||||
this.setContent(lineNumberTextArea);
|
||||
this.setContent(new VirtualizedScrollPane<>(lineNumberTextArea));
|
||||
setAutoLine(AppConfigController.getInstance().getAutoLineConfig());
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ public class ToolHorizontalBox extends AbstractHorizontalBox {
|
||||
|
||||
// 将 JNotepadToolBar 添加为子节点
|
||||
getChildren().add(SidebarToolBar.getInstance());
|
||||
getStyleClass().add("tool-horizontal-box");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,29 +4,7 @@
|
||||
-fx-vbar-policy: as-needed;
|
||||
}
|
||||
|
||||
/*!* 不显示滚动条 *!*/
|
||||
/*.text-line-number .content {*/
|
||||
/* -fx-cursor: text;*/
|
||||
/* -fx-padding: 8px 1px 8px 5px;*/
|
||||
/*}*/
|
||||
.text-line-number .content {
|
||||
-fx-padding: 8px 1px 8px 5px;
|
||||
}
|
||||
.text-line-number .scroll-bar:vertical {
|
||||
-fx-pref-width: 1;
|
||||
-fx-opacity: 0;
|
||||
}
|
||||
|
||||
.text-line-number .scroll-bar:horizontal {
|
||||
-fx-pref-height: 10;
|
||||
-fx-opacity: 0;
|
||||
}
|
||||
|
||||
/* 主文本框区域样式 */
|
||||
.main-text-area {
|
||||
-fx-border-color: white;
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
/* tab修改标签样式 */
|
||||
.tab-title-editable {
|
||||
@ -36,3 +14,24 @@
|
||||
-fx-font-size: 14px;
|
||||
-fx-padding: 2px 2px 2px 2px;
|
||||
}
|
||||
|
||||
/*左侧边栏*/
|
||||
.tool-horizontal-box {
|
||||
-fx-border-width: 0 1 0 0;
|
||||
-fx-border-color: -color-border-default;
|
||||
}
|
||||
|
||||
|
||||
.paragraph-box .has-caret {
|
||||
-fx-background-color: -color-neutral-muted
|
||||
}
|
||||
|
||||
.line-number-text-area .paragraph-box .text {
|
||||
/*-fx-fill: -color-fg-default;*/
|
||||
/* -fx-font-size: 18px;*/
|
||||
}
|
||||
|
||||
.lineno {
|
||||
-fx-background-color: -color-bg-default;
|
||||
/*-fx-padding: 0 10 0 0;*/
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user