本文整理匯總了Java中org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java RSyntaxTextArea.setText方法的具體用法?Java RSyntaxTextArea.setText怎麽用?Java RSyntaxTextArea.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
的用法示例。
在下文中一共展示了RSyntaxTextArea.setText方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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);
}
示例3: getComponent
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
@Override
public Component getComponent(GraphDocument document) {
if(settingsPanel == null) {
settingsPanel = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
printOnlyChangedBox = new JCheckBox("Print only changed values");
printOnlyChangedBox.setSelected(printOnlyChanged);
settingsPanel.add(printOnlyChangedBox, gbc);
++gbc.gridy;
gbc.fill = GridBagConstraints.BOTH;
gbc.weighty = 1.0;
includesArea = new RSyntaxTextArea();
includesArea.setText(includes.stream().collect(Collectors.joining("\n")));
final RTextScrollPane includesScroller = new RTextScrollPane(includesArea);
includesScroller.setBorder(BorderFactory.createTitledBorder("Includes"));
settingsPanel.add(includesScroller, gbc);
++gbc.gridy;
excludesArea = new RSyntaxTextArea();
excludesArea.setText(excludes.stream().collect(Collectors.joining("\n")));
final RTextScrollPane excludesScroller = new RTextScrollPane(excludesArea);
excludesScroller.setBorder(BorderFactory.createTitledBorder("Excludes"));
settingsPanel.add(excludesScroller, gbc);
}
return settingsPanel;
}
示例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: loadJarFile
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
public void loadJarFile(String name) {
String jarName = GlobalValues.jarFilePath;
try {
JarEntry entry;
exampleArea = new RSyntaxTextArea();
exampleArea.setFont(new Font(GlobalValues.paneFontName, Font.PLAIN, GlobalValues.paneFontSize));
exampleArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SCALA);
exampleArea.setCodeFoldingEnabled(true);
exampleArea.setText("");
JarInputStream zin = new JarInputStream(new FileInputStream(jarName));
while ((entry = zin.getNextJarEntry()) != null) {
if (entry.getName().equals(name)) {
// read entry into text area
BufferedReader in = new BufferedReader(new InputStreamReader(zin));
String line;
while ((line = in.readLine()) != null) {
exampleArea.append(line);
exampleArea.append("\n");
}
}
zin.closeEntry();
}
zin.close();
} catch (IOException e) {
e.printStackTrace();
}
exampleScrollPane = new RTextScrollPane(exampleArea);
JFrame exampleFrame = new JFrame(selectedExample);
exampleFrame.add(exampleScrollPane);
exampleFrame.pack();
exampleFrame.setVisible(true);
}
示例7: getComponent
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
@Override
public Component getComponent(int width, int height) throws IOException {
final JPanel base = new JPanel();
base.setOpaque(false);
base.setPreferredSize(new Dimension(width, height));
base.setLayout(new BorderLayout());
final JPanel controls = new JPanel();
final JButton runBtn = new JButton("Run");
runBtn.setActionCommand("run");
runBtn.addActionListener(this);
controls.add(runBtn);
base.add(controls, BorderLayout.NORTH);
textArea = new RSyntaxTextArea(20, 60);
Font font = textArea.getFont();
font = font.deriveFont(font.getStyle(), 18);
textArea.setFont(font);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_GROOVY);
textArea.setCodeFoldingEnabled(true);
textArea.setText(initialScript);
final RTextScrollPane inputScrollPane = new RTextScrollPane(textArea);
outputPane = new JTextPane();
outputPane.setEditable(false);
outputPane.setFont(new Font("Monospaced", Font.PLAIN, 18));
outputPane.setBorder(new EmptyBorder(4, 4, 4, 4));
final JScrollPane outputScrollPane = new JScrollPane(outputPane);
splitPane = new JSplitPane(orientation, inputScrollPane, outputScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(width / 2);
final Dimension minimumSize = new Dimension(100, 50);
inputScrollPane.setMinimumSize(minimumSize);
outputScrollPane.setMinimumSize(minimumSize);
final JPanel body = new JPanel();
body.setBackground(Color.RED);
body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));
body.add(splitPane);
base.add(body, BorderLayout.CENTER);
installInterceptors();
return base;
}
示例8: QueryWindow
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
public QueryWindow(final WindowContext windowContext, final Datastore datastore, final String query) {
super(windowContext);
_datastore = datastore;
_queryTextArea = new RSyntaxTextArea(5, 17);
_queryTextArea.setFont(WidgetUtils.FONT_MONOSPACE);
_queryTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
_queryTextArea.setText(query);
_limitTextField = WidgetFactory.createTextField(null, 3);
_limitTextField.setDocument(new NumberDocument(false, false));
_limitTextField.setText("500");
_table = new DCTable();
_queryButton = WidgetFactory.createPrimaryButton("Execute query", IconUtils.MODEL_QUERY);
_queryButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
final String queryString = _queryTextArea.getText();
logger.debug("Query being parsed: {}", queryString);
try (DatastoreConnection con = _datastore.openConnection()) {
final DataContext dataContext = con.getDataContext();
final Query q = dataContext.parseQuery(queryString);
logger.info("Parsed query: {}", q);
final String limitString = _limitTextField.getText();
if (!StringUtils.isNullOrEmpty(limitString)) {
final int limit = Integer.parseInt(limitString);
q.setMaxRows(limit);
}
final DataSet dataSet = dataContext.executeQuery(q);
_centerPanel.setVisible(true);
_table.setModel(new DataSetTableModel(dataSet));
} catch (final MetaModelException e) {
WidgetUtils.showErrorMessage("Failed to execute query", e.getMessage(), e);
}
}
});
_centerPanel = _table.toPanel();
_centerPanel.setVisible(false);
final DCPanel decoratedLimitTextField = WidgetUtils.decorateWithShadow(_limitTextField, false, 0);
final DCPanel buttonPanel = new DCPanel();
WidgetUtils.addToGridBag(DCLabel.dark("Max rows:"), buttonPanel, 1, 1, GridBagConstraints.CENTER);
WidgetUtils.addToGridBag(decoratedLimitTextField, buttonPanel, 2, 1, GridBagConstraints.CENTER);
WidgetUtils.addToGridBag(_queryButton, buttonPanel, 1, 2, 2, 1);
final JScrollPane scrolledTextArea = new JScrollPane(_queryTextArea);
final DCPanel decoratedTextField = WidgetUtils.decorateWithShadow(scrolledTextArea);
_upperPanel = new DCPanel();
_upperPanel.setLayout(new BorderLayout());
_upperPanel.add(decoratedTextField, BorderLayout.CENTER);
_upperPanel.add(buttonPanel, BorderLayout.EAST);
}
示例9: init
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
private void init() {
setLayout(new BorderLayout());
final DialogHeader header = new DialogHeader("SendPraat",
"Execute script in Praat");
add(header, BorderLayout.NORTH);
final JPanel contentPane = new JPanel(new BorderLayout());
final JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0,
0));
waitForResponseBox = new JCheckBox("Listen for response");
// topPanel.add(waitForResponseBox);
contentPane.add(topPanel, BorderLayout.NORTH);
// AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory)TokenMakerFactory.getDefaultInstance();
// atmf.putMapping("text/vm", "ca.phon.plugins.praat.VelocityTokenMaker");
textArea = new RSyntaxTextArea() {
@Override
public void paintComponent(Graphics g) {
final Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
super.paintComponent(g2d);
}
};
textArea.setLineWrap(false);
textArea.setRows(30);
textArea.setColumns(80);
textArea.setText(loadTemplate().getScriptText());
// textArea.setSyntaxEditingStyle("text/vm");
final RTextScrollPane scroller = new RTextScrollPane(textArea, true);
contentPane.add(scroller, BorderLayout.CENTER);
final JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0,
0));
final PhonUIAction previewAct = new PhonUIAction(this, "onPreviewScript");
previewAct.putValue(PhonUIAction.NAME, "Preview Script");
previewButton = new JButton(previewAct);
final PhonUIAction sendPraatAct = new PhonUIAction(this, "onSendPraat");
sendPraatAct.putValue(PhonUIAction.NAME, "SendPraat");
sendPraatAct.putValue(PhonUIAction.SMALL_ICON, IconManager
.getInstance().getIcon("apps/praat", IconSize.SMALL));
sendPraatButton = new JButton(sendPraatAct);
btnPanel.add(waitForResponseBox);
btnPanel.add(previewButton);
btnPanel.add(sendPraatButton);
contentPane.add(btnPanel, BorderLayout.SOUTH);
add(contentPane, BorderLayout.CENTER);
}
示例10: getComponent
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
@Override
public Component getComponent(GraphDocument document) {
if(settingsPanel == null) {
settingsPanel = new JPanel(new BorderLayout());
final JPanel btnPanel = new JPanel(new VerticalLayout());
showAsText = new JRadioButton("Show data as plain text");
showAsGroup.add(showAsText);
showAsCSV = new JRadioButton("Show data as table (CSV)");
showAsGroup.add(showAsCSV);
showAsHTML = new JRadioButton("Show data as HTML");
showAsGroup.add(showAsHTML);
showAsText.setSelected(this.showText);
showAsCSV.setSelected(this.showTable);
showAsHTML.setSelected(this.showHTML);
btnPanel.add(showAsText);
btnPanel.add(showAsCSV);
btnPanel.add(showAsHTML);
btnPanel.setBorder(BorderFactory.createTitledBorder("Data Format"));
settingsPanel.add(btnPanel, BorderLayout.NORTH);
final JPanel dataInputPanel = new JPanel(new BorderLayout());
final HidablePanel helpMessage = new HidablePanel(PrintBufferNode.class.getName() + ".helpMessage");
helpMessage.setBottomLabelText("<html>Enter data to add to buffer below. If data is given in the box below and "
+ "in the node 'data' input field during execution, the resulting text will be the data from the field below with "
+ "the text from the input field relpacing the token $DATA.</html>");
dataInputPanel.add(helpMessage, BorderLayout.NORTH);
dataInputArea = new RSyntaxTextArea();
dataInputArea.setSyntaxEditingStyle(RSyntaxTextArea.SYNTAX_STYLE_NONE);
dataInputArea.setText(this.dataTemplate);
final RTextScrollPane textScroller = new RTextScrollPane(dataInputArea);
settingsPanel.add(textScroller);
dataInputPanel.add(textScroller, BorderLayout.CENTER);
settingsPanel.add(dataInputPanel, BorderLayout.CENTER);
}
return settingsPanel;
}
示例11: init
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //導入方法依賴的package包/類
private void init() {
setLayout(new BorderLayout());
cardPanel = new JPanel();
cardLayout = new CardLayout();
cardPanel.setLayout(cardLayout);
paramPanel = new JPanel(new BorderLayout());
try {
updateParamPanel();
} catch (PhonScriptException e1) {
LOGGER.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
}
cardPanel.add(new JScrollPane(paramPanel), paramPanelId);
// setup editor and save button
scriptEditor = new RSyntaxTextArea();
scriptEditor.setText(script.getScript());
scriptEditor.setColumns(20);
scriptEditor.setCaretPosition(0);
RTextScrollPane scriptScroller = new RTextScrollPane(scriptEditor);
scriptEditor.setSyntaxEditingStyle("text/javascript");
scriptEditor.getDocument().addDocumentListener(scriptDocListener);
cardPanel.add(scriptScroller, scriptEditorId);
ImageIcon viewIcon =
IconManager.getInstance().getIcon("apps/accessories-text-editor", IconSize.SMALL);
scriptViewButton = new JToggleButton(viewIcon);
scriptViewButton.setSelected(false);
scriptViewButton.setToolTipText("Toggle script/form");
scriptViewButton.putClientProperty("JButton.buttonType", "textured");
scriptViewButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean showEditor = scriptViewButton.isSelected();
if(showEditor) {
showScript();
} else {
showForm();
}
scriptViewButton.setSelected(showEditor);
}
});
final FlowLayout layout = new FlowLayout(FlowLayout.RIGHT);
layout.setVgap(0);
formBtnPanel = new JPanel(layout);
formBtnPanel.add(scriptViewButton);
add(cardPanel, BorderLayout.CENTER);
add(formBtnPanel, BorderLayout.SOUTH);
}