本文整理匯總了Java中javax.swing.JViewport.setScrollMode方法的典型用法代碼示例。如果您正苦於以下問題:Java JViewport.setScrollMode方法的具體用法?Java JViewport.setScrollMode怎麽用?Java JViewport.setScrollMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JViewport
的用法示例。
在下文中一共展示了JViewport.setScrollMode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: displaySearchField
import javax.swing.JViewport; //導入方法依賴的package包/類
/**
* Adds the search field to the tree.
*/
private void displaySearchField() {
if ((getModel().getSize() > 0) && !searchTextField.isDisplayable()) {
JViewport viewport = ListView.this.getViewport();
originalScrollMode = viewport.getScrollMode();
viewport.setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
//Rectangle visibleTreeRect = getVisibleRect();
prepareSearchPanel();
add(searchpanel);
revalidate();
repaint();
// bugfix #28501, avoid the chars duplicated on jdk1.3
SwingUtilities.invokeLater(
new Runnable() {
public void run() {
searchTextField.requestFocus();
}
}
);
}
}
示例2: displaySearchField
import javax.swing.JViewport; //導入方法依賴的package包/類
/**
* Adds the search field to the tree.
*/
private void displaySearchField(char initialChar) {
if( null != searchpanel )
return;
JViewport vp = scrollPane.getViewport();
originalScrollMode = vp.getScrollMode();
vp.setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
searchTextField.setFont(getFont());
searchTextField.setText(String.valueOf(initialChar));
prepareSearchPanel();
scrollPane.add(searchpanel);
invalidate();
revalidate();
repaint();
searchTextField.requestFocus();
}
示例3: createComponent
import javax.swing.JViewport; //導入方法依賴的package包/類
private static JComponent createComponent() {
createStyles();
for (int i = 0; i < data.length; i++) {
Paragraph p = data[i];
addParagraph(p);
}
JTextPane textPane = new JTextPane(doc);
JScrollPane scroller = new JScrollPane();
JViewport port = scroller.getViewport();
port.setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
port.add(textPane);
return scroller;
}