本文整理了Java中javax.swing.JScrollPane.getLocationOnScreen()
方法的一些代码示例,展示了JScrollPane.getLocationOnScreen()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.getLocationOnScreen()
方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称: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();
}
}
内容来源于网络,如有侵权,请联系作者删除!