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

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

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

JScrollPane.getLocationOnScreen介绍

暂无

代码示例

代码示例来源:origin: jaltekruse/OpenNotebook

public Point docPt2AbsoluteScreenPos(PointInDocument ptInDoc) {
      Point scrollPanelPos = docScrollPane.getLocationOnScreen();
      Point panelPoint = docPt2PanelPt(ptInDoc);
      // TODO - logging
//        System.out.println(String.format( "panelPoint: (%s,%s), scrollPanelPos(screenPos): (%s,%s), viewPort:(%s,%s)",
//                panelPoint.x, panelPoint.y,
//                (int) scrollPanelPos.getX(), (int) scrollPanelPos.getY(),
//                docScrollPane.getViewport().getX(),
//                docScrollPane.getViewport().getY()));

      return new Point(
          (int) scrollPanelPos.getX() + panelPoint.x - (int)docScrollPane.getViewport().getViewPosition().getX(),
          (int) scrollPanelPos.getY() + panelPoint.y - (int)docScrollPane.getViewport().getViewPosition().getY()
      );
  }

代码示例来源:origin: chatty/chatty

private void showFixedChatInfo() {
  if (popup == null) {
    if (fixedChatInfoLabel == null) {
      createFixedChatInfoLabel();
    }
    JLabel label = fixedChatInfoLabel;
    Point p = scrollpane.getLocationOnScreen();
    int labelWidth = label.getPreferredSize().width;
    p.x += scrollpane.getViewport().getWidth() - labelWidth - 5;
    popup = PopupFactory.getSharedInstance().getPopup(
        ChannelTextPane.this, label, p.x, p.y);
    popup.show();
  }
}

相关文章

JScrollPane类方法