Browse Source

代码编辑器

master
richie 5 years ago
parent
commit
e9e70d28a9
  1. 20
      src/main/java/com/fanruan/api/design/ui/component/code/SyntaxConstants.java
  2. 37
      src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextArea.java
  3. 30
      src/main/java/com/fanruan/api/design/ui/component/code/UISyntaxTextScrollPane.java
  4. 16
      src/main/java/com/fanruan/api/design/ui/container/UIScrollPane.java

20
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";
}

37
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
* 代码编辑器支持javascriptsqljava公式和普通文本
* @see com.fanruan.api.design.ui.component.code.SyntaxConstants
* <p>
* UISyntaxTextArea contentTextArea = new UISyntaxTextArea();
* contentTextArea.setCloseCurlyBraces(true);
* contentTextArea.setLineWrap(true);
* contentTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
* contentTextArea.setCodeFoldingEnabled(true);
* contentTextArea.setAntiAliasingEnabled(true);
* </p>
*/
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);
}
}

30
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);
}
}

16
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);
}
}
Loading…
Cancel
Save