本文整理汇总了Java中javax.swing.JScrollPane.getViewport方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.getViewport方法的具体用法?Java JScrollPane.getViewport怎么用?Java JScrollPane.getViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.getViewport方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/** Overridden - JTable's implementation of the method will
* actually attach (and leave behind) a gratuitous border
* on the enclosing scroll pane. */
protected final void configureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
JViewport viewport = scrollPane.getViewport();
if ((viewport == null) || (viewport.getView() != this)) {
return;
}
scrollPane.setColumnHeaderView(getTableHeader());
}
}
}
示例2: updateColumnSelectionMouseListener
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* This method update mouse listener on the scrollPane if it is needed.
* It also recomputes the model of searchCombo. Both actions are needed after
* the set of visible columns is changed.
*/
void updateColumnSelectionMouseListener() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane)gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.removeMouseListener(columnSelectionMouseListener);
if (getColumnModel().getColumnCount() == 0) {
scrollPane.addMouseListener(columnSelectionMouseListener);
}
}
}
if (searchCombo != null) {
searchCombo.setModel(getSearchComboModel());
}
}
示例3: unconfigureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
protected void unconfigureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(null);
scrollPane.setRowHeaderView(null);
viewport.removeChangeListener(scrollListener);
rowHeader.uninstall();
}
}
}
示例4: unconfigureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
protected void unconfigureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(null);
scrollPane.setRowHeaderView(null);
viewport.removeChangeListener(scrollListener);
rowHeader.uninstall();
}
}
}
示例5: createComponent
import javax.swing.JScrollPane; //导入方法依赖的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;
}
示例6: createScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private JScrollPane createScrollPane(Component inner) {
JScrollPane result = new JScrollPane(inner);
JViewport vp = result.getViewport();
vp.addMouseListener(this);
MarginViewportUI ui = (MarginViewportUI) MarginViewportUI.createUI(vp);
vp.setUI(ui);
ui.setMarginPainted(marginPainted);
ui.setMarginColor(marginColor);
ui.setEmptyString(emptyString);
result.setBorder(BorderFactory.createEmptyBorder());
result.setViewportBorder(result.getBorder());
return result;
}
示例7: configureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* duplicated to avoid repeating the same checks multiple times
*/
@Override
protected void configureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(getTableHeader());
Border border = scrollPane.getBorder();
if (border == null || border instanceof UIResource) {
scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
}
//rowHeader=new RowHeader(dataModel);
rowHeader.setRowHeight(CommonConstants.ROW_HEIGHT);
rowHeader.install(this, scrollPane);
installLabels(scrollPane);
installSelectAllButton(scrollPane);
viewport.addChangeListener(scrollListener);
}
}
}
示例8: configureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* duplicated to avoid repeating the same checks multiple times
*/
@Override
protected void configureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(getTableHeader());
Border border = scrollPane.getBorder();
if (border == null || border instanceof UIResource) {
scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
}
//rowHeader=new RowHeader(dataModel);
rowHeader.install(this, scrollPane);
installLabels(scrollPane);
installSelectAllButton(scrollPane);
viewport.addChangeListener(scrollListener);
}
}
}
示例9: 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);
}