diff --git a/src/main/java/com/fanruan/api/design/ui/component/code/SyntaxConstants.java b/src/main/java/com/fanruan/api/design/ui/component/code/SyntaxConstants.java new file mode 100644 index 0000000..f2a5756 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/component/code/SyntaxConstants.java @@ -0,0 +1,20 @@ +package com.fanruan.api.design.ui.component.code; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-28 + * 代码编辑器用到的常量 + */ +public interface SyntaxConstants { + + String SYNTAX_STYLE_NONE = "text/plain"; + + String SYNTAX_STYLE_JAVA = "text/java"; + + String SYNTAX_STYLE_JAVASCRIPT = "text/javascript"; + + String SYNTAX_STYLE_SQL = "text/sql"; + + String SYNTAX_STYLE_FORMULA = "text/formula"; +} diff --git a/src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextArea.java b/src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextArea.java new file mode 100644 index 0000000..bd1ea0f --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextArea.java @@ -0,0 +1,37 @@ +package com.fanruan.api.design.ui.component.code; + +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-28 + * 代码编辑器,支持javascript、sql、java、公式和普通文本 + * @see com.fanruan.api.design.ui.component.code.SyntaxConstants + *
+ * UISyntaxTextArea contentTextArea = new UISyntaxTextArea(); + * contentTextArea.setCloseCurlyBraces(true); + * contentTextArea.setLineWrap(true); + * contentTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT); + * contentTextArea.setCodeFoldingEnabled(true); + * contentTextArea.setAntiAliasingEnabled(true); + *
+ */ +public class UISyntaxTextArea extends RSyntaxTextArea { + + public UISyntaxTextArea() { + super(); + } + + public UISyntaxTextArea(String text) { + super(text); + } + + public UISyntaxTextArea(int rows, int cols) { + super(rows, cols); + } + + public UISyntaxTextArea(String text, int rows, int cols) { + super(text, rows, cols); + } +} diff --git a/src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextScrollPane.java b/src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextScrollPane.java new file mode 100644 index 0000000..4b38e45 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextScrollPane.java @@ -0,0 +1,30 @@ +package com.fanruan.api.design.ui.component.code; + +import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; + +import java.awt.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-28 + * 可滚动的代码编辑器容器 + */ +public class UISyntaxTextScrollPane extends RTextScrollPane { + + public UISyntaxTextScrollPane() { + + } + + public UISyntaxTextScrollPane(Component component) { + super(component); + } + + public UISyntaxTextScrollPane(Component component, boolean lineNumbers) { + super(component, lineNumbers); + } + + public UISyntaxTextScrollPane(Component component, boolean lineNumbers, Color lineNumberColor) { + super(component, lineNumbers, lineNumberColor); + } +} diff --git a/src/main/java/com/fanruan/api/design/ui/container/UIScrollPane.java b/src/main/java/com/fanruan/api/design/ui/container/UIScrollPane.java new file mode 100644 index 0000000..681e193 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/container/UIScrollPane.java @@ -0,0 +1,16 @@ +package com.fanruan.api.design.ui.container; + +import java.awt.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-28 + * 可滚动容器 + */ +public class UIScrollPane extends com.fr.design.gui.icontainer.UIScrollPane { + + public UIScrollPane(Component component) { + super(component); + } +}