本文整理汇总了Java中javax.swing.JScrollPane.setVerticalScrollBar方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.setVerticalScrollBar方法的具体用法?Java JScrollPane.setVerticalScrollBar怎么用?Java JScrollPane.setVerticalScrollBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.setVerticalScrollBar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScrollPanel
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public ScrollPanel(LogFrame frame) {
super(frame);
this.table = new TablePanel(frame);
JScrollPane pane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
pane.setVerticalScrollBar(table.getVerticalScrollBar());
setLayout(new BorderLayout());
add(pane);
}
示例2: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private void initComponents() {
table = new DetailsTable();
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JViewport viewport = new Viewport(table);
final JScrollPane tableScroll = new JScrollPane(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
tableScroll.setViewport(viewport);
tableScroll.setBorder(BorderFactory.createEmptyBorder());
tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
public int getUnitIncrement(int direction) {
JViewport vp = tableScroll.getViewport();
Scrollable view = (Scrollable)(vp.getView());
Rectangle vr = vp.getViewRect();
return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
}
public int getBlockIncrement(int direction) {
JViewport vp = tableScroll.getViewport();
Scrollable view = (Scrollable)(vp.getView());
Rectangle vr = vp.getViewRect();
return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
}
public void setValues(int newValue, int newExtent, int newMin, int newMax) {
setEnabled(newExtent < newMax);
if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
newValue = newMax - newExtent;
super.setValues(newValue, newExtent, newMin, newMax);
}
};
tableScroll.setVerticalScrollBar(scrollBar);
dataContainer = tableScroll;
JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
noDataLabel.setEnabled(false);
noDataContainer = new JPanel(new BorderLayout());
noDataContainer.setOpaque(false);
noDataContainer.add(noDataLabel, BorderLayout.CENTER);
setOpaque(false);
setLayout(new BorderLayout());
add(noDataContainer, BorderLayout.CENTER);
}