SWT Application Window 的问题
我在新建了SWT Application Window
想给TEXT 加一个addMouseListener
但是有错误
我是按照eclipse从入门到精通的例子
我的 代码是这样的
/*
* Created on 2006-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.swtdesigner;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Test {
private static Text helloText;
/**
* Launch the application
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(500, 375);
shell.setText("SWT Application");
//
shell.open();
helloText = new Text(shell, SWT.BORDER);
helloText.addMouseListener(new myTextMouseListener());
helloText.setText("Hello");
//helloText.set
helloText.setBounds(171, 103, 95, 24);
// text.set
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
private static final class myTextMouseListener extends MouseAdapter {
public void MouseDoubleClick(MouseEvent e)
{
MessageDialog.openInformation(null,"","fdsfsadfas");
}
}
}
helloText.addMouseListener(new myTextMouseListener());
eclipse 提示错误
The method addMouseListener(MouseListener) in the type Control is not applicable for the
arguments (Test.myTextMouseListener)