本文整理匯總了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);
}
}
});
}