2024年8月3日14:19:27

master
qmstyle 2024-08-03 14:19:33 +08:00
parent 1f38db9ee4
commit e3b648100d
2 changed files with 31 additions and 3 deletions

12
pom.xml
View File

@ -10,8 +10,8 @@
<properties> <properties>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<netty.version>4.1.48.Final</netty.version> <netty.version>4.1.48.Final</netty.version>
<fastjson.version>2.0.27</fastjson.version> <fastjson.version>2.0.27</fastjson.version>
<jwt.version>0.9.1</jwt.version> <jwt.version>0.9.1</jwt.version>
@ -529,6 +529,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>14</source>
<target>14</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -7,6 +7,7 @@ import javafx.embed.swing.SwingNode;
import javafx.geometry.Bounds; import javafx.geometry.Bounds;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaUI;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rsyntaxtextarea.Theme; import org.fife.ui.rsyntaxtextarea.Theme;
import org.fife.ui.rtextarea.RTextScrollPane; import org.fife.ui.rtextarea.RTextScrollPane;
@ -27,6 +28,8 @@ public class RxEditer extends AnchorPane{
private final RSyntaxTextArea textArea = new RSyntaxTextArea(); private final RSyntaxTextArea textArea = new RSyntaxTextArea();
private RTextScrollPane sp;
public RSyntaxTextArea getTextArea(){ public RSyntaxTextArea getTextArea(){
return textArea; return textArea;
} }
@ -62,6 +65,7 @@ public class RxEditer extends AnchorPane{
SwingNode sn = new SwingNode(); SwingNode sn = new SwingNode();
new Thread(()->{ new Thread(()->{
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
textArea.setEditable(true);//编辑器 textArea.setEditable(true);//编辑器
if (style == null || style.equals("")) { if (style == null || style.equals("")) {
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);//java textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);//java
@ -85,11 +89,27 @@ public class RxEditer extends AnchorPane{
line.setValue(linenum); line.setValue(linenum);
column.setValue(columnnum); column.setValue(columnnum);
}); });
RTextScrollPane sp = new RTextScrollPane(textArea); sp= new RTextScrollPane(textArea);
changeStyleViaThemeXml(theme); changeStyleViaThemeXml(theme);
sp.setBorder(null);
sn.setContent(sp); sn.setContent(sp);
}); });
}).start(); }).start();
widthProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
textArea.setSize(newValue.intValue(),textArea.getHeight());
}
});
heightProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
textArea.setSize(textArea.getWidth(),newValue.intValue());
}
});
getChildren().add(sn); getChildren().add(sn);
setTopAnchor(sn, 0.0); setTopAnchor(sn, 0.0);
setBottomAnchor(sn, 0.0); setBottomAnchor(sn, 0.0);