e865. converting between component and screen coordinates.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 9 行

TXT
9
字号
This example demonstrates how to convert a coordinate within a component to a coordinate on the screen and visa versa. 
    // Convert a coordinate relative to a component's bounds to screen coordinates
    Point pt = new Point(component.getLocation());
    SwingUtilities.convertPointToScreen(pt, component);
    
    // Convert a coordinate on a screen to a coordinate relative to a component's bounds
    SwingUtilities.convertPointFromScreen(pt, component);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?