Java文档上写
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
我没太看懂。比如
button.addMouseListener(new MouseAdapter() {
public void mouseDown(final MouseEvent e) {
Point pt1 = button.toDisplay(0, 0);
Point pt2 = shell.toDisplay(e.x, e.y);
offset[0] = new Point(pt2.x - pt1.x, pt2.y - pt1.y);
}
});
pt1和pt2得到的都是什么东西?
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
我没太看懂。比如
button.addMouseListener(new MouseAdapter() {
public void mouseDown(final MouseEvent e) {
Point pt1 = button.toDisplay(0, 0);
Point pt2 = shell.toDisplay(e.x, e.y);
offset[0] = new Point(pt2.x - pt1.x, pt2.y - pt1.y);
}
});
pt1和pt2得到的都是什么东西?
解决方案 »
- ssh中,js如何获取多选框的值并传入action,下面是我的代码,大家帮忙修改一下,并帮我写出action感激不尽
- 使用JAAS的问题
- String=什么 然后就不用转义
- setDaemon()和isDaemon
- swt 焦点切换
- [分享]JAVA变量path , classpth ,java_home设置方法和作用
- if (e.getKeyCode() == KeyEvent.VK_A)...为什么不起作用?
- 真想不通 Thinking in java 干嘛要出第三版
- 网络传输的接收问题。急!急!急!!!!
- 前辈求帮助一下,下面的代码为什么会错
- repaint()方法不自动调用update()方法(急 在线等)
- jdk的源代码是不是要另外下啊?
Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver. //将 Point 由 Display 的绝对值转化为 Control 的相对值。toDisplay ( Point point)
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
//将 Point 由 Control 的相对值转化为 Display 的绝对值。 Example:
Button button = new Button( s, SWT. BORDER );
System. out .println( button.getLocation( ) ); //Point {0, 0}
System. out .println( button.toDisplay( button.getLocation( ) ) ); //Point {70, 89}
System. out .println( button.toControl( button.toDisplay( button.getLocation( ) ) ) ); //Point {0, 0}Device类:
getDepth()
Returns the bit depth of the screen, which is the number of bits it takes to represent the number of unique colors that the screen is currently capable of displaying.
//拿到操作系统的颜色深度。 getDPI()
Returns a point whose x coordinate is the horizontal dots per inch of the display, and whose y coordinate is the vertical dots per inch of the display.
//拿到操作系统的DPI值。Example:
System.out.println(Display.getDefault( ).getDepth( ));//32
System.out.println(Display.getDefault( ).getDPI( ));//Point {96, 96}
本人不是很了解SWT,查到一点希望对楼主有用
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
//将 Point 由 Control 的相对值转化为 Display 的绝对值。