[英]Why does the SWT Selection event for a slider never have a detail?
I was following the SWT Slider Snippet example and the event detail is always 0 aka SWT.NONE on fedora yet the detail is set on windows 7. The example can be found here http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTSliderprintscrolleventdetails.htm and here is the code I'm running. 我遵循的是SWT Slider Snippet示例,并且事件详细信息在fedora上始终为0,即SWT.NONE,但详细信息已在Windows 7上进行了设置。可以在以下示例中找到该示例:http://www.java2s.com/Code/Java/ SWT-JFace-Eclipse / SWTSliderprintscrolleventdetails.htm ,这是我正在运行的代码。
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
final Slider slider = new Slider(shell, SWT.HORIZONTAL);
slider.setBounds(10, 10, 200, 32);
slider.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String string = "SWT.NONE";
switch (event.detail) {
case SWT.DRAG:
string = "SWT.DRAG";
break;
case SWT.HOME:
string = "SWT.HOME";
break;
case SWT.END:
string = "SWT.END";
break;
case SWT.ARROW_DOWN:
string = "SWT.ARROW_DOWN";
break;
case SWT.ARROW_UP:
string = "SWT.ARROW_UP";
break;
case SWT.PAGE_DOWN:
string = "SWT.PAGE_DOWN";
break;
case SWT.PAGE_UP:
string = "SWT.PAGE_UP";
break;
}
System.out.println(slider.getSelection());
System.out.println("Scroll detail -> " + string);
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
The this bug and this bug are said resolved, but not working on my machine(Ubuntu 12.04 eclipse version is Kepler). 这个错误和这个错误已经解决,但在我的机器上不起作用(Ubuntu 12.04 eclipse版本为Kepler)。
Thus raised a new bug here . 因此在这里提出了一个新的错误 。
Refer my post SWT Scrollbar events on Linux here I said other work around to detect these events. 请参阅我在Linux上发布的SWT滚动条事件,这里我说了其他方法来检测这些事件。
Also wait check in Eclipse Luna(to be release on 25th June). 另外,请等待检入Eclipse Luna(将于6月25日发布)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.