本文整理汇总了Java中org.fife.ui.rtextarea.RTextScrollPane.setViewportView方法的典型用法代码示例。如果您正苦于以下问题:Java RTextScrollPane.setViewportView方法的具体用法?Java RTextScrollPane.setViewportView怎么用?Java RTextScrollPane.setViewportView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fife.ui.rtextarea.RTextScrollPane
的用法示例。
在下文中一共展示了RTextScrollPane.setViewportView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runButtonActionPerformed
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runButtonActionPerformed
ensureOutputShown();
final RubyConsole con = new RubyConsole();
con.setMargin(new Insets(8, 8, 8, 8));
RTextScrollPane pane = new RTextScrollPane();
pane.setBorder(BorderFactory.createEmptyBorder());
pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
pane.setViewportView(con);
addDirectoryTree(con.getRuntime(), Amber.getWorkspace().getRootDirectory());
closeableTabbedPane.add(pane, "Run");
closeableTabbedPane.setSelectedComponent(pane);
new Thread() {
@Override
public void run() {
con.eval(editor.getText());
con.getRuntime().getOutputStream().println("\n\nExited.");
con.setEditable(false);
}
}.start();
}
示例2: irbButtonActionPerformed
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
private void irbButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_irbButtonActionPerformed
ensureOutputShown();
final RubyConsole con = new RubyConsole();
con.setMargin(new Insets(8, 8, 8, 8));
RTextScrollPane pane = new RTextScrollPane();
pane.setBorder(BorderFactory.createEmptyBorder());
pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
pane.setViewportView(con);
addDirectoryTree(con.getRuntime(), Amber.getWorkspace().getRootDirectory());
closeableTabbedPane.add(pane, "IRB");
closeableTabbedPane.setSelectedComponent(pane);
con.getRuntime().getOutputStream().println("Welcome to the IRB Console\n\n");
new Thread() {
@Override
public void run() {
con.eval("require 'irb'; require 'irb/completion'; IRB.start");
}
}.start();
}
示例3: addTextArea
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的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);
}
示例4: createMainPanel
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
private JComponent createMainPanel() {
txpQuery = new RSyntaxTextArea();
txpQuery.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
scpQuery = new RTextScrollPane(txpQuery, true);
scpQuery.setFoldIndicatorEnabled(true);
scpQuery.setViewportView(txpQuery);
scpRules = new JScrollPane();
tblRules = new JTable();
tblRules.setFillsViewportHeight(true);
tblRules.setPreferredSize(new Dimension(100, 100));
tblRules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tblRules.setEditingColumn(0);
tblRules.setAutoCreateColumnsFromModel(true);
tblRules.setAutoCreateRowSorter(false);
tblRules.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
scpRules.setSize(tblRules.getPreferredSize());
scpRules.setViewportView(tblRules);
tblSelectResults = new JTable();
sppSelectResults = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
sppSelectResults.setTopComponent(scpQuery);
sppSelectResults.setBottomComponent(new JScrollPane(tblSelectResults));
JSplitPane spp = new JSplitPane();
spp.setRightComponent(sppSelectResults);
spp.setDividerLocation(0.3);
spp.setLeftComponent(new JScrollPane(tblRules));
return spp;
}
示例5: initializeUI
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的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: addTextArea
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的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);
}
}
});
}