-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from rememberber/develop
Develop
- Loading branch information
Showing
12 changed files
with
506 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/com/luoboduner/moo/tool/ui/component/RegexRTextScrollPane.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.luoboduner.moo.tool.ui.component; | ||
|
||
import com.formdev.flatlaf.FlatLaf; | ||
import com.luoboduner.moo.tool.App; | ||
import org.fife.ui.rtextarea.Gutter; | ||
import org.fife.ui.rtextarea.RTextScrollPane; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
public class RegexRTextScrollPane extends RTextScrollPane { | ||
// constructor | ||
public RegexRTextScrollPane(RegexSyntaxTextViewer textArea) { | ||
super(textArea); | ||
|
||
setMaximumSize(new Dimension(-1, -1)); | ||
setMinimumSize(new Dimension(-1, -1)); | ||
|
||
Color defaultBackground = App.mainFrame.getBackground(); | ||
|
||
Gutter gutter = getGutter(); | ||
if (FlatLaf.isLafDark()) { | ||
gutter.setBorderColor(gutter.getLineNumberColor().darker()); | ||
} else { | ||
gutter.setBorderColor(gutter.getLineNumberColor().brighter()); | ||
} | ||
gutter.setBackground(defaultBackground); | ||
Font font2 = new Font(App.config.getFont(), Font.PLAIN, App.config.getFontSize()); | ||
gutter.setLineNumberFont(font2); | ||
gutter.setBackground(UIManager.getColor("Editor.gutter.background")); | ||
gutter.setBorderColor(UIManager.getColor("Editor.gutter.borderColor")); | ||
gutter.setLineNumberColor(UIManager.getColor("Editor.gutter.lineNumberColor")); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/com/luoboduner/moo/tool/ui/component/RegexSyntaxTextViewer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,68 @@ | ||
package com.luoboduner.moo.tool.ui.component; | ||
|
||
import com.formdev.flatlaf.FlatLaf; | ||
import com.luoboduner.moo.tool.App; | ||
import com.luoboduner.moo.tool.ui.form.func.TimeConvertForm; | ||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; | ||
import org.fife.ui.rsyntaxtextarea.SyntaxConstants; | ||
import org.fife.ui.rsyntaxtextarea.Theme; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.io.IOException; | ||
|
||
public class RegexSyntaxTextViewer extends RSyntaxTextArea { | ||
public RegexSyntaxTextViewer() { | ||
|
||
setDoubleBuffered(true); | ||
|
||
try { | ||
Theme theme; | ||
if (FlatLaf.isLafDark()) { | ||
theme = Theme.load(RegexSyntaxTextViewer.class.getResourceAsStream( | ||
"/org/fife/ui/rsyntaxtextarea/themes/monokai.xml")); | ||
} else { | ||
theme = Theme.load(RegexSyntaxTextViewer.class.getResourceAsStream( | ||
"/org/fife/ui/rsyntaxtextarea/themes/idea.xml")); | ||
} | ||
theme.apply(this); | ||
} catch (IOException ioe) { // Never happens | ||
ioe.printStackTrace(); | ||
} | ||
|
||
setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE); | ||
setCodeFoldingEnabled(true); | ||
// setCurrentLineHighlightColor(new Color(52, 52, 52)); | ||
// setUseSelectedTextColor(true); | ||
// setSelectedTextColor(new Color(50, 50, 50)); | ||
|
||
// 初始化背景色 | ||
// Style.blackTextArea(this); | ||
setBackground(TimeConvertForm.getInstance().getTimeHisTextArea().getBackground()); | ||
// 初始化边距 | ||
setMargin(new Insets(10, 10, 10, 10)); | ||
|
||
// 初始化字体 | ||
String fontName = App.config.getJsonBeautyFontName(); | ||
int fontSize = App.config.getJsonBeautyFontSize(); | ||
if (fontSize == 0) { | ||
fontSize = getFont().getSize() + 2; | ||
} | ||
Font font = new Font(fontName, Font.PLAIN, fontSize); | ||
setFont(font); | ||
|
||
setHyperlinksEnabled(false); | ||
|
||
|
||
setBackground(UIManager.getColor("Editor.background")); | ||
setCaretColor(UIManager.getColor("Editor.caretColor")); | ||
setSelectionColor(UIManager.getColor("Editor.selectionBackground")); | ||
setCurrentLineHighlightColor(UIManager.getColor("Editor.currentLineHighlight")); | ||
setMarkAllHighlightColor(UIManager.getColor("Editor.markAllHighlightColor")); | ||
setMarkOccurrencesColor(UIManager.getColor("Editor.markOccurrencesColor")); | ||
setMatchedBracketBGColor(UIManager.getColor("Editor.matchedBracketBackground")); | ||
setMatchedBracketBorderColor(UIManager.getColor("Editor.matchedBracketBorderColor")); | ||
setPaintMatchedBracketPair(true); | ||
setAnimateBracketMatching(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/main/java/com/luoboduner/moo/tool/ui/form/func/JavaConsoleForm.form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.luoboduner.moo.tool.ui.form.func.JavaConsoleForm"> | ||
<grid id="27dc6" binding="javaConsolePanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="12" left="12" bottom="12" right="12"/> | ||
<constraints> | ||
<xy x="26" y="46" width="494" height="567"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<grid id="5956" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="10" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="804be" class="javax.swing.JButton" binding="clean"> | ||
<constraints> | ||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value="清除"/> | ||
</properties> | ||
</component> | ||
<component id="54894" class="javax.swing.JButton" binding="run"> | ||
<constraints> | ||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text value="执行"/> | ||
</properties> | ||
</component> | ||
<component id="8d9f4" class="javax.swing.JLabel"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<font size="14"/> | ||
<text value="输入Java或groovy代码点击执行即可"/> | ||
</properties> | ||
</component> | ||
<hspacer id="73c3d"> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</hspacer> | ||
</children> | ||
</grid> | ||
<splitpane id="76c59"> | ||
<constraints> | ||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> | ||
<preferred-size width="200" height="200"/> | ||
</grid> | ||
</constraints> | ||
<properties> | ||
<continuousLayout value="true"/> | ||
<dividerLocation value="463"/> | ||
<dividerSize value="3"/> | ||
</properties> | ||
<border type="none"/> | ||
<children> | ||
<scrollpane id="7a589"> | ||
<constraints> | ||
<splitpane position="left"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="61044" class="javax.swing.JTextArea" binding="codeArea"> | ||
<constraints/> | ||
<properties> | ||
<background color="-13947600"/> | ||
<font name="Consolas" size="16"/> | ||
<text value=""/> | ||
</properties> | ||
</component> | ||
</children> | ||
</scrollpane> | ||
<scrollpane id="8cb4d"> | ||
<constraints> | ||
<splitpane position="right"/> | ||
</constraints> | ||
<properties/> | ||
<border type="none"/> | ||
<children> | ||
<component id="286fe" class="javax.swing.JTextArea" binding="resultArea"> | ||
<constraints/> | ||
<properties> | ||
<background color="-13947600"/> | ||
<editable value="false"/> | ||
<font name="Consolas" size="16"/> | ||
</properties> | ||
</component> | ||
</children> | ||
</scrollpane> | ||
</children> | ||
</splitpane> | ||
</children> | ||
</grid> | ||
</form> |
Oops, something went wrong.