本文整理匯總了Java中org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.setEditable方法的典型用法代碼示例。如果您正苦於以下問題:Java RSyntaxTextArea.setEditable方法的具體用法?Java RSyntaxTextArea.setEditable怎麽用?Java RSyntaxTextArea.setEditable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
的用法示例。
在下文中一共展示了RSyntaxTextArea.setEditable方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: process
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
@Override
public void process(ClientletContext context) throws ClientletException {
try {
InputStream in = context.getResponse().getInputStream();
try {
String text = IORoutines.loadAsText(in, "UTF-8");
RSyntaxTextArea textArea = new RSyntaxTextArea(text);
logger.error("extension: " + extension);
switch (extension) {
case "css":
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_CSS);
break;
case "js":
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
break;
case "xml":
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
break;
case "xaml":
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
break;
default:
break;
}
textArea.setEditable(false);
JScrollPane pane = new JScrollPane(textArea);
context.setResultingContent(pane);
} finally {
in.close();
}
} catch (IOException ioe) {
throw new ClientletException(ioe);
}
}
示例3: display
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
@Override
public void display(String title, BufferedReader r, String toFocus) {
RSyntaxTextArea textArea = new RSyntaxTextArea(40, 80);
try {
textArea.read(r, null);
r.close();
textArea.setCaretPosition(0);
} catch (IOException ioe) {
UIManager.getLookAndFeel().provideErrorFeedback(null);
ioe.printStackTrace();
return;
}
textArea.setEditable(false);
textArea.setSyntaxEditingStyle("text/zscript");
textArea.setCodeFoldingEnabled(true);
Frame owner = Frame.getFrames()[0];
JDialog dialog = new JDialog(owner);
dialog.setContentPane(new RTextScrollPane(textArea));
dialog.setTitle(title + " (read-only)");
dialog.pack();
dialog.setLocationRelativeTo(null);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
SearchContext context = new SearchContext(toFocus, true);
SearchEngine.find(textArea, context);
}
示例4: JavaEditor
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
public JavaEditor(JavaFile file) {
this.file = file;
mainSplitPane = new JSplitPane();
mainSplitPane.setContinuousLayout(true);
mainSplitPane.setResizeWeight(0.5);
textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
textArea.setEditable(false);
textArea.setAnimateBracketMatching(true);
textArea.setAntiAliasingEnabled(true);
textArea.setClearWhitespaceLinesEnabled(true);
textArea.setCodeFoldingEnabled(true);
textArea.setPaintMarkOccurrencesBorder(true);
textArea.setPaintMatchedBracketPair(true);
textArea.setMarkOccurrences(true);
textArea.getCaret().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent paramChangeEvent) {
textArea.getCaret().setVisible(true);
}
});
int mod = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
ResourceBundle msg = ResourceBundle.getBundle("org.fife.ui.rtextarea.RTextArea");
RecordableTextAction copyAction = new RTextAreaEditorKit.CopyAction();
copyAction.setProperties(msg, "Action.Copy");
copyAction.setAccelerator(KeyStroke.getKeyStroke(67, mod));
JPopupMenu menu = new JPopupMenu();
menu.add(createPopupMenuItem(copyAction));
menu.add(createPopupMenuItem(new RenameAction()));
textArea.setPopupMenu(menu);
textArea.setText(
"package abc;\r\n\r\npublic class Example{\r\n\tprivate int example = 0;\r\n\t\r\n\tpublic void example(){\r\n\t\tSystem.out.println(\"hi!\");\r\n\t}\r\n\t\r\n\tpublic static void main(String[] args){\r\n\t\texample();\r\n\t}\r\n}");
textArea.convertSpacesToTabs();
theme.apply(textArea);
RTextScrollPane scrollPane = new RTextScrollPane(textArea, true);
scrollPane.getGutter().setBookmarkingEnabled(true);
scrollPane.getGutter()
.setBookmarkIcon(new ImageIcon(EditorWindow.class.getResource("/resources/menu/connection.gif")));
scrollPane.setIconRowHeaderEnabled(true);
scrollPane.setFoldIndicatorEnabled(true);
mainSplitPane.setLeftComponent(scrollPane);
JScrollPane treeScrollPane = new JScrollPane();
mainSplitPane.setRightComponent(treeScrollPane);
JTree tree = new JTree();
tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Example") {
{
DefaultMutableTreeNode node_1;
node_1 = new DefaultMutableTreeNode("Variables");
node_1.add(new DefaultMutableTreeNode("int example"));
add(node_1);
node_1 = new DefaultMutableTreeNode("Methods");
node_1.add(new DefaultMutableTreeNode("public void example()"));
node_1.add(new DefaultMutableTreeNode("public static void main(String[] args)"));
add(node_1);
add(new DefaultMutableTreeNode("Patches"));
}
}));
treeScrollPane.setViewportView(tree);
}
示例5: initializeUI
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
private void initializeUI(){
setLayout(new BorderLayout(0, 0));
JSplitPane splitPaneMain = new JSplitPane();
splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT);
add(splitPaneMain, BorderLayout.CENTER);
JPanel panelTop = new JPanel();
splitPaneMain.setLeftComponent(panelTop);
panelTop.setLayout(new BorderLayout(0, 0));
JSplitPane splitPaneTop = new JSplitPane();
splitPaneTop.setResizeWeight(0.3);
panelTop.add(splitPaneTop);
panelAction = new SamlPanelAction(controller);
splitPaneTop.setLeftComponent(panelAction);
panelInformation = new SamlPanelInfo();
splitPaneTop.setRightComponent(panelInformation);
JPanel panelText = new JPanel();
splitPaneMain.setRightComponent(panelText);
panelText.setLayout(new BorderLayout(0, 0));
textArea = new RSyntaxTextArea();
textArea.setText("<failureInInitialization></failureInInitialization>");
scrollPane = new RTextScrollPane(textArea);
scrollPane.add(textArea);
panelText.add(scrollPane, BorderLayout.CENTER);
scrollPane.setViewportView(textArea);
this.invalidate();
this.updateUI();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
textArea.setEditable(true);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(false);
textArea.setAnimateBracketMatching(false);
textArea.setAutoIndentEnabled(false);
textArea.setBracketMatchingEnabled(false);
}
示例6: createContentPanel
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
/**
* @param debuggerActions
* @return
*/
static Component createContentPanel(final AgentDebuggerFrame frame) {
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
final RSyntaxTextArea scriptEditorTA = new RSyntaxTextArea();
frame.setScriptEditorTA(scriptEditorTA);
scriptEditorTA.setSelectionColor(scriptEditorTA.getCurrentLineHighlightColor());
scriptEditorTA.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
scriptEditorTA.setHyperlinksEnabled(false);
scriptEditorTA.setEditable(false);
scriptEditorTA.setEnabled(false);
scriptEditorTA.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
scriptEditorTA.grabFocus();
try {
int offs = scriptEditorTA.viewToModel(e.getPoint());
if (offs > -1) {
int line = scriptEditorTA.getLineOfOffset(offs);
if (frame.getSteps().size() > line) {
frame.fireStepChanged(line);
if (e.getClickCount() == 2 && !e.isPopupTrigger()) {
// show step xml
try {
DebugStep debugStep = frame.getSteps().get(line);
String text = JaxbUtil.marshall(debugStep.getStepRun());
StepDialog dlg = new StepDialog(frame, text,
SyntaxConstants.SYNTAX_STYLE_XML);
dlg.setVisible(true);
} catch (JAXBException e1) {
frame.showError("Error showing step xml: " + e);
}
}
}
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Never happens
}
}
});
RTextScrollPane scriptEditorScrollPane = new RTextScrollPane(scriptEditorTA);
frame.setScriptEditorScrollPane(scriptEditorScrollPane);
scriptEditorScrollPane.setIconRowHeaderEnabled(true);
scriptEditorScrollPane.getGutter().setBookmarkIcon(ActionProducer.getIcon("bullet_blue.png", IconSize.SMALL));
scriptEditorScrollPane.getGutter().setCurrentLineIcon(
ActionProducer.getIcon("current_line.png", IconSize.SMALL));
scriptEditorScrollPane.getGutter().setBookmarkingEnabled(true);
pane.setLeftComponent(scriptEditorScrollPane);
pane.setRightComponent(createRightPanel(frame));
pane.setDividerLocation(300);
pane.setResizeWeight(0.4D);
return pane;
}
示例7: addTextArea
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
private void addTextArea() {
jtfFilter = new JTextField();
findButton = new JButton("Next word");
textArea = new RSyntaxTextArea();
textArea.setHighlightCurrentLine(true);
textArea.setAnimateBracketMatching(true);
textArea.setAntiAliasingEnabled(true);
textArea.setEditable(false);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
scrollBar = new RTextScrollPane(textArea);
scrollBar.setBorder(null);
scrollBar.setLineNumbersEnabled(true);
scrollBar.setViewportView(textArea);
this.getContentPane().add(scrollBar);
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel("Specify a word to match:"), BorderLayout.WEST);
panel.add(jtfFilter, BorderLayout.CENTER);
panel.add(findButton, BorderLayout.EAST);
add(panel, BorderLayout.SOUTH);
findButton.addActionListener(e -> {
String find = jtfFilter.getText().toLowerCase();
textArea.requestFocusInWindow();
if (!Strings.isBlank(find)) {
Document document = textArea.getDocument();
int findLength = find.length();
try {
boolean found = false;
if (pos + findLength > document.getLength()) {
pos = 0;
}
while (pos + findLength <= document.getLength()) {
String match = document.getText(pos, findLength).toLowerCase();
if (match.equals(find)) {
found = true;
break;
}
pos++;
}
if (found) {
Rectangle viewRect = textArea.modelToView(pos);
textArea.scrollRectToVisible(viewRect);
textArea.setCaretPosition(pos + findLength);
textArea.moveCaretPosition(pos);
pos += findLength;
}
} catch (Exception exp) {
logger.log(Level.ERROR, exp);
}
}
});
}
示例8: scriptListLoaded
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
private void scriptListLoaded(List<ScriptInfo> scripts) {
JSplitPane cp = new JSplitPane();
cp.setUI(new CleanSplitPaneUI());
Vector<String> colNames = new Vector<String>();
colNames.add(Messages.getString("ScriptSearchDialog.TableColumn.Script"));
colNames.add(Messages.getString("ScriptSearchDialog.TableColumn.Rating"));
colNames.add(Messages.getString("ScriptSearchDialog.TableColumn.Author"));
colNames.add(Messages.getString("ScriptSearchDialog.TableColumn.Tags"));
colNames.add(Messages.getString("ScriptSearchDialog.TableColumn.StartedDate"));
model = new FilterableTableModel(colNames, 0) {
@Override
public Class<?> getColumnClass(int colIndex) {
switch (colIndex) {
case 0:
return ScriptInfo.class;
case 1:
return Integer.class;
default:
return String.class;
}
}
};
model.addFilterColumn(0);
model.addFilterColumn(2);
model.addFilterColumn(3);
model.addFilterColumn(4);
for (ScriptInfo script : scripts) {
Vector<Object> row = new Vector<Object>();
row.add(script);
row.add(Integer.valueOf(script.getRating()));
row.add(script.getAuthor());
row.add(ZScriptUIUtils.prettyPrint(script.getSearchTags()));
row.add(script.getDateCreated());
model.addRow(row);
}
table = createTable(model);
table.getSelectionModel().addListSelectionListener(listener);
RScrollPane sp = new RScrollPane(table);
JPanel temp = new JPanel(new BorderLayout());
temp.add(sp);
cp.setLeftComponent(temp);
if (getComponentOrientation().isLeftToRight()) {
temp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
}
else {
temp.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
}
JPanel descPanel = new JPanel(new BorderLayout(0, 5));
descPanel.add(createScriptDetailsPanel(), BorderLayout.NORTH);
scriptTextArea = new RSyntaxTextArea();//30, 80);
scriptTextArea.setSyntaxEditingStyle(Plugin.SYNTAX_STYLE_ZSCRIPT);
scriptTextArea.setCodeFoldingEnabled(true);
scriptTextArea.setEditable(false);
//scriptTextArea.setUseSelectedTextColor(true);
descPanel.add(new RTextScrollPane(scriptTextArea));
cp.setRightComponent(descPanel);
replaceMainContentWith(cp);
setChildrenEnabled(filterPanel, true);
Dimension size = getPreferredSize();
if (size.width<1024) {
size.width = 1024;
}
setSize(size);
//pack();
new ScriptRatingFetcher(scripts).start();
}