本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.setSyntaxEditingStyle方法的典型用法代码示例。如果您正苦于以下问题:Java RSyntaxTextArea.setSyntaxEditingStyle方法的具体用法?Java RSyntaxTextArea.setSyntaxEditingStyle怎么用?Java RSyntaxTextArea.setSyntaxEditingStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
的用法示例。
在下文中一共展示了RSyntaxTextArea.setSyntaxEditingStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StepDialog
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public StepDialog(AgentDebuggerFrame f, String text, String type) {
super(f, true);
this.f = f;
setLayout(new BorderLayout());
ta = new RSyntaxTextArea();
ta.setSyntaxEditingStyle(type);
ta.setHyperlinksEnabled(false);
ta.setText(text);
ta.setCaretPosition(0);
RTextScrollPane sp = new RTextScrollPane(ta);
sp.setIconRowHeaderEnabled(true);
add(BorderLayout.CENTER, sp);
add(createButtonPanel(), BorderLayout.SOUTH);
setSize(new Dimension(800, 600));
setBounds(new Rectangle(getSize()));
setPreferredSize(getSize());
WindowUtil.centerOnParent(this);
}
示例2: newTextArea
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private RSyntaxTextArea newTextArea(){
// JTextArea textArea = new JTextArea();
// textArea.setAutoscrolls(true);
//// textArea.getDocument().addUndoableEditListener(undoMg);
// textArea.addMouseListener(new TextAreaMouseListener());
RSyntaxTextArea textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
textArea.setCodeFoldingEnabled(true);
textArea.setAntiAliasingEnabled(true);
textArea.setAutoscrolls(true);
SyntaxScheme scheme = textArea.getSyntaxScheme();
// scheme.getStyle(Token.COMMENT_KEYWORD).foreground = Color.red;
// scheme.getStyle(Token.DATA_TYPE).foreground = Color.blue;
scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = Color.BLUE;
scheme.getStyle(Token.LITERAL_NUMBER_DECIMAL_INT).foreground = new Color(164, 0, 0);
scheme.getStyle(Token.LITERAL_NUMBER_FLOAT).foreground = new Color(164, 0, 0);
scheme.getStyle(Token.LITERAL_BOOLEAN).foreground = Color.RED;
scheme.getStyle(Token.OPERATOR).foreground = Color.BLACK;
textArea.revalidate();
textArea.addMouseListener(new TextAreaMouseListener());
return textArea;
}
示例3: createBottomPanel
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
/**
* @param debuggerActions
* @param loadChooser
* @return
*/
static Component createBottomPanel(final AgentDebuggerFrame frame) {
JPanel panel = new JPanel(new BorderLayout());
RSyntaxTextArea loggerTA = new RSyntaxTextArea();
frame.setLoggerTA(loggerTA);
loggerTA.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
loggerTA.setHyperlinksEnabled(false);
loggerTA.setEditable(false);
loggerTA.setHighlightCurrentLine(false);
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(frame.getDebuggerActions().getSaveLogAction());
popupMenu.add(frame.getDebuggerActions().getClearLogOutputAction());
loggerTA.setPopupMenu(popupMenu);
RTextScrollPane sp = new RTextScrollPane(loggerTA);
sp.setIconRowHeaderEnabled(false);
sp.getGutter().setBookmarkingEnabled(false);
panel.add(sp, BorderLayout.CENTER);
DebuggerAppender.addTextArea(loggerTA);
return panel;
}
示例4: displayJavaConfigInfo
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public static void displayJavaConfigInfo() {
JFrame dframe = new JFrame("Java Runtime Information");
final RSyntaxTextArea jt = new RSyntaxTextArea();
jt.setFont(new Font(GlobalValues.paneFontName, Font.PLAIN, GlobalValues.paneFontSize));
jt.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
jt.setCodeFoldingEnabled(true);
StringBuilder sb = new StringBuilder();
for (Map.Entry e : System.getProperties().entrySet()) {
String se = (String) e.getKey();
if (se.startsWith("java")) {
//System.out.println("se = "+e.toString());
sb.append(e.toString() + "\n");
}
}
jt.setText(sb.toString());
RTextScrollPane jp = new RTextScrollPane(jt);
dframe.add(jp);
dframe.setLocation(200, 200);
dframe.setSize(400, 400);
dframe.setVisible(true);
}
示例5: CustomCodeSyntaxPane
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public CustomCodeSyntaxPane() {
panel = new JPanel(new BorderLayout());
textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
textArea.setAntiAliasingEnabled(true);
textArea.setCodeFoldingEnabled(true);
textArea.setFont(DerivedConfig.getPanelContentFont());
// setup autocompletion
for (String word : getAutocompletionStrings()) {
provider.addCompletion(new BasicCompletion(provider, word));
}
new AutoCompletion(provider).install(textArea);
scrollPane = new RTextScrollPane(textArea);
scrollPane.setFoldIndicatorEnabled(true);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
panel.add(scrollPane);
textArea.getDocument().putProperty(PlainDocument.tabSizeAttribute, 3); // Reduce tab size
}
示例6: TextEditorDemo
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public TextEditorDemo() {
JPanel cp = new JPanel(new BorderLayout());
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory)TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/c3dg", "org.konte.ui.KonteRSTATokenMaker");
RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60);
textArea.setSyntaxEditingStyle("text/c3dg");
textArea.setCodeFoldingEnabled(true);
RTextScrollPane sp = new RTextScrollPane(textArea);
cp.add(sp);
setContentPane(cp);
setTitle("Text Editor Demo");
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
}
示例7: buildCodePane
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
/**
* Builds the code pane
*
* @return JComponent
*/
private JComponent buildCodePane() {
textArea = new RSyntaxTextArea(20, 60);
textArea.setSyntaxEditingStyle(syntaxStyle);
textArea.setCodeFoldingEnabled(true);
try {
Theme theme = Theme.load(getClass().getResourceAsStream("CodeEditorTheme.xml"));
theme.apply(textArea);
} catch (IOException e) {
ExceptionHandler.get().handle(e);
}
return new RTextScrollPane(textArea);
}
示例8: getHtmlPane
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public static RSyntaxTextArea getHtmlPane() {
/*
* JEditorPane htmlPane = new JEditorPane();
* htmlPane.setBackground(Color.WHITE);
* htmlPane.setForeground(Color.BLACK); Font font = new
* Font(Font.SANS_SERIF, Font.PLAIN, 20); htmlPane.setFont(font);
*/
RSyntaxTextArea textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
textArea.setCodeFoldingEnabled(true);
Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 16);
textArea.setFont(font);
return textArea;
}
示例9: createSyntaxTextField
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private RSyntaxTextArea createSyntaxTextField()
{
RSyntaxTextArea area = new RSyntaxTextArea();
area.setRows(3);
area.setLineWrap(true);
area.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
area.setHighlightCurrentLine(false);
return area;
}
示例10: createEditorScrollPane
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
/**
* Constructs an editor scroll pane
* @param code the set code in the editor pane before the user makes edits
* @return the constructed scroll pane
*/
public JScrollPane createEditorScrollPane(String code)
{
editorPane = new RSyntaxTextArea(code);
editorPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
editorPane.setCodeFoldingEnabled(true);
try
{
spellParser = SpellingParser.createEnglishSpellingParser(new File(ArJClassEditor.class.getProtectionDomain().getCodeSource().getLocation().getPath() + "english_dic.zip"), true);
} catch (IOException ioe) {}
if (spellParser != null)
{
try
{
File userDict= File.createTempFile("spellDemo", ".txt");
spellParser.setUserDictionary(userDict);
}
catch (Exception e) {}
SwingUtilities.invokeLater(
new Runnable()
{
@Override
public void run()
{
editorPane.addParser(spellParser);
}
}
);
}
JScrollPane editorScrollPane = new JScrollPane(editorPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
return editorScrollPane;
}
示例11: createUIComponents
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private void createUIComponents() {
textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JSON);
textArea.setCodeFoldingEnabled(true);
scrollView = new JScrollPane(textArea);
try {
Theme theme = Theme.load(getClass().getResourceAsStream(
"/org/fife/ui/rsyntaxtextarea/themes/monokai.xml"));
theme.apply(textArea);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
示例12: addTextArea
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private void addTextArea() {
textArea = new RSyntaxTextArea();
textArea.setHighlightCurrentLine(true);
textArea.setAnimateBracketMatching(true);
textArea.setAntiAliasingEnabled(true);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_HTML);
scrollBar = new RTextScrollPane(textArea);
scrollBar.setBorder(null);
scrollBar.setLineNumbersEnabled(true);
scrollBar.setViewportView(textArea);
this.getContentPane().add(scrollBar);
}
示例13: AutoCompleteDemo
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public AutoCompleteDemo() {
JPanel contentPane = new JPanel(new BorderLayout());
RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
textArea.setCodeFoldingEnabled(true);
contentPane.add(new RTextScrollPane(textArea));
// A CompletionProvider is what knows of all possible completions, and
// analyzes the contents of the text area at the caret position to
// determine what completion choices should be presented. Most instances
// of CompletionProvider (such as DefaultCompletionProvider) are
// designed
// so that they can be shared among multiple text components.
CompletionProvider provider = createCompletionProvider();
// An AutoCompletion acts as a "middle-man" between a text component
// and a CompletionProvider. It manages any options associated with
// the auto-completion (the popup trigger key, whether to display a
// documentation window along with completion choices, etc.). Unlike
// CompletionProviders, instances of AutoCompletion cannot be shared
// among multiple text components.
AutoCompletion ac = new AutoCompletion(provider);
ac.setParameterAssistanceEnabled(true);
ac.setAutoCompleteEnabled(true);
ac.install(textArea);
setContentPane(contentPane);
setTitle("AutoComplete Demo");
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
}
示例14: PrologSourceEditor
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public PrologSourceEditor() {
super("Editor", new RSyntaxTextArea());
final RSyntaxTextArea theEditor = (RSyntaxTextArea) this.editor;
theEditor.setTabsEmulated(true);
theEditor.setSyntaxEditingStyle("text/jprol");
theEditor.getSyntaxScheme().getStyle(Token.VARIABLE).foreground = Color.RED.darker();
theEditor.getSyntaxScheme().getStyle(Token.VARIABLE).font = theEditor.getFont().deriveFont(Font.BOLD);
theEditor.getInputMap().put(KeyStroke.getKeyStroke("control Z"), "none");
theEditor.getInputMap().put(KeyStroke.getKeyStroke("control Y"), "none");
theEditor.setAntiAliasingEnabled(true);
theEditor.setBracketMatchingEnabled(true);
theEditor.setCodeFoldingEnabled(true);
removePropertyFromList("EdWordWrap");
editor.setForeground(Color.BLACK);
editor.setBackground(Color.WHITE);
editor.setCaretColor(Color.BLACK);
editor.setFont(new Font("Courier", Font.BOLD, 14));
editor.setVisible(true);
setEnabled(true);
this.undoManager = new RUndoManager(theEditor);
}
示例15: configureScriptTextArea
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private void configureScriptTextArea(RSyntaxTextArea eventContent, RTextScrollPane scrollPane_2, String syntaxStyle)
{
eventContent.setSyntaxEditingStyle(syntaxStyle);
eventContent.getFoldManager().setCodeFoldingEnabled(true);
eventContent.setFont(new Font("Hack", Font.PLAIN, 16));
eventContent.setRows(3);
eventContent.setMarkOccurrences(true);
eventContent.setLineWrap(true);
eventContent.setWrapStyleWord(true);
scrollPane_2.setLineNumbersEnabled(true);
scrollPane_2.setFoldIndicatorEnabled(true);
}