javax.swing.JScrollPane.getBounds()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中javax.swing.JScrollPane.getBounds()方法的一些代码示例,展示了JScrollPane.getBounds()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.getBounds()方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:getBounds

JScrollPane.getBounds介绍

暂无

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet-demos

/**
 * Scrolls the GUI panel to the bottom to show latest result
 * whenever a new image added to the GUI panel
 */
private static void scrollToBottomAndRepaint(ImageClassificationPanel panel) {
  Component[] components = panel.getComponents();
  for (Component component : components) {
    if (component instanceof JScrollPane) {
      JScrollPane scrollPane = (JScrollPane) component;
      JList list = (JList) scrollPane.getViewport().getView();
      int size = list.getModel().getSize();
      list.setSelectedIndex(Math.max(size - 2, list.getLastVisibleIndex()));
      JScrollBar vertical = scrollPane.getVerticalScrollBar();
      vertical.setValue(vertical.getMaximum());
      panel.repaint(scrollPane.getBounds());
    }
  }
}

代码示例来源:origin: girtel/Net2Plan

@Override
 public void layoutContainer(Container parent) {
  JScrollPane scrollPane = (JScrollPane)parent;
  Rectangle availR = scrollPane.getBounds();
  availR.x = availR.y = 0;
  Insets insets = parent.getInsets();
  availR.x = insets.left;
  availR.y = insets.top;
  availR.width  -= insets.left + insets.right;
  availR.height -= insets.top  + insets.bottom;
  Rectangle vsbR = new Rectangle();
  vsbR.width  = 5;
  vsbR.height = availR.height;
  vsbR.x = availR.x + availR.width - vsbR.width;
  vsbR.y = availR.y;
  if(viewport != null) {
   viewport.setBounds(availR);
  }
  if(vsb != null) {
   vsb.setVisible(true);
   vsb.setBounds(vsbR);
  }
 }
});

代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget

protected Point getInnerInsetPt(JScrollPane testComp, Point aPt) {
  Point res = new Point(0, 0);
  if (testComp != null && aPt != null) {
    int autoscrollZone = Math.round(INSET_ZONE * autoscrollingVelocityFactor);
    Rectangle viewRect = autoscrollingPane.getBounds();
    JScrollBar vSb = autoscrollingPane.getVerticalScrollBar();
    if (vSb != null && vSb.isVisible()) {
      viewRect.width -= vSb.getWidth();
    }
    JScrollBar hSb = autoscrollingPane.getHorizontalScrollBar();
    if (hSb != null && hSb.isVisible()) {
      viewRect.height -= hSb.getHeight();
    }
    if (aPt.x > 0 && aPt.x < INSET_ZONE) {
      res.x = -autoscrollZone;
    } else if (aPt.x > viewRect.width - INSET_ZONE && aPt.x < viewRect.width) {
      res.x = autoscrollZone;
    }
    if (aPt.y > 0 && aPt.y < INSET_ZONE) {
      res.y = -autoscrollZone;
    } else if (aPt.y > viewRect.height - INSET_ZONE && aPt.y < viewRect.height) {
      res.y = autoscrollZone;
    }
  }
  return res;
}

代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget

protected boolean isInnerInsetPt(JScrollPane testComp, Point aPt) {
  if (testComp == null) {
    return false;
  }
  Rectangle bounds = testComp.getBounds();
  bounds.x = 0;
  bounds.y = 0;
  JScrollBar vSb = testComp.getVerticalScrollBar();
  if (vSb != null && vSb.isVisible()) {
    bounds.width -= vSb.getWidth();
  }
  JScrollBar hSb = testComp.getHorizontalScrollBar();
  if (hSb != null && hSb.isVisible()) {
    bounds.height -= hSb.getHeight();
  }
  return ((aPt.x > 0 && aPt.x < INSET_ZONE)
      || (aPt.x > bounds.width - INSET_ZONE && aPt.x < bounds.width)
      || (aPt.y > 0 && aPt.y < INSET_ZONE)
      || (aPt.y > bounds.height - INSET_ZONE && aPt.y < bounds.height));
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
   * Removes the overlay.
   */
  public void endOverlay() {
    view.getComponent().requestFocus();
    if (editScrollContainer != null) {
      editScrollContainer.setVisible(false);
      view.getComponent().remove(editScrollContainer);

      Rectangle bounds = editScrollContainer.getBounds();
      view.getComponent().repaint(bounds.x, bounds.y, bounds.width, bounds.height);
    }
    if (editedFigure != null) {
      editedFigure.removeFigureListener(figureHandler);
      editedFigure = null;
    }
  }
}

代码示例来源:origin: girtel/Net2Plan

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Rectangle availR = scrollPane.getBounds();
availR.x = availR.y = 0;

代码示例来源:origin: com.jidesoft/jide-oss

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Rectangle availR = scrollPane.getBounds();
availR.x = availR.y = 0;

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
final Rectangle availR = scrollPane.getBounds();
final Insets insets = parent.getInsets();
availR.x = insets.left;

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Rectangle availR = scrollPane.getBounds();
Insets insets = parent.getInsets();
availR.x = insets.left;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Rectangle availR = scrollPane.getBounds();
availR.x = availR.y = 0;

代码示例来源:origin: com.eas.platypus/platypus-js-forms

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Rectangle availR = scrollPane.getBounds();
availR.x = availR.y = 0;

代码示例来源:origin: com.jidesoft/jide-oss

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Rectangle availR = scrollPane.getBounds();
availR.x = availR.y = 0;

相关文章

JScrollPane类方法