本文整理汇总了Java中javax.swing.JViewport.addChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java JViewport.addChangeListener方法的具体用法?Java JViewport.addChangeListener怎么用?Java JViewport.addChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JViewport
的用法示例。
在下文中一共展示了JViewport.addChangeListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeVisibleSpan
import javax.swing.JViewport; //导入方法依赖的package包/类
private int[] computeVisibleSpan() {
Component parent = pane.getParent();
if (parent instanceof JLayeredPane) {
parent = parent.getParent();
}
if (parent instanceof JViewport) {
JViewport vp = (JViewport) parent;
Point start = vp.getViewPosition();
Dimension size = vp.getExtentSize();
Point end = new Point((int) (start.getX() + size.getWidth()), (int) (start.getY() + size.getHeight()));
int startPosition = pane.viewToModel(start);
int endPosition = pane.viewToModel(end);
if (parentWithListener != vp) {
vp.addChangeListener(WeakListeners.change(this, vp));
parentWithListener = vp;
}
return new int[] {startPosition, endPosition};
}
return new int[] {0, pane.getDocument().getLength()};
}
示例2: addViewportListener
import javax.swing.JViewport; //导入方法依赖的package包/类
private void addViewportListener(JEditorPane pane) {
Container parent = pane.getParent();
if (parent instanceof JLayeredPane) {
parent = parent.getParent();
}
if (parent instanceof JViewport) {
JViewport viewport = (JViewport) parent;
viewport.addChangeListener(WeakListeners.change(AnnotationHolder.this, viewport));
}
}
示例3: configureEnclosingScrollPane
import javax.swing.JViewport; //导入方法依赖的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);
}
}
}
示例4: addNotify
import javax.swing.JViewport; //导入方法依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
Component c = getParent();
// Keep scrolling of the row table in sync with the main table.
if (c instanceof JViewport) {
JViewport viewport = (JViewport) c;
viewport.addChangeListener(this);
}
}
示例5: configureEnclosingScrollPane
import javax.swing.JViewport; //导入方法依赖的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);
}
}
}
示例6: subscribeActual
import javax.swing.JViewport; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super ChangeEvent> observer) {
JViewport w = widget;
ChangeEventConsumer aec = new ChangeEventConsumer(observer, w);
observer.onSubscribe(aec);
w.addChangeListener(aec);
if (aec.get() == null) {
aec.onDispose(w);
}
}