代码如下:
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.layout.RowLayout;
public class test {
         
/**
 * @param args
 */
public static void main(String[] args) {
// TODO 自动生成方法存根  final Display display = new Display();
 final Shell shell = new Shell(display);
 RowLayout layout=new RowLayout();
 shell.setLayout(layout);
 Button b=new Button(shell,SWT.PUSH);
 b.setText("hello");
 b.setToolTipText("中山南路");
 b.pack();
shell.pack();
shell.open();
 while (!shell.isDisposed ()) {
 if (!display.readAndDispatch ()) display.sleep ();
 }
 display.dispose ();
}}
程序能运行,就是鼠标放在Button上不出来提示?

解决方案 »

  1.   

    效果是有了,可有时有,有时没的,而且等了好长时间才有,怎么设置鼠标一放上去提示马上显示啊。是SWT的。
      

  2.   

    把org.eclipse.swt.widgets.Button换成javax.swing.JButton
      

  3.   

    饿~~~
    SWT和swing能通用吗?高手说给个代码吧
      

  4.   

    SWT本身仅仅是Eclipse组织为了开发Eclipse IDE环境所编写的一组底层图形界面 API,那换成Swing又无所谓的,至少我遮掩认为,你不妨试一下