eclipse 执行setVisible(true)报错怎么解决?

panQAQ 2015-10-13 08:58:50
写了个程序,想通过eclipse显示UI界面,在windows上运行成功,在Mac上就报错,请问怎么解决?
public class DeviceFunction {
public static ArrayList<MyDevice> AllDevices=new ArrayList<MyDevice>();

public static testui Testtool;

public static void main(String[] args){
try {
DeviceFunction.init();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public static void init() throws IOException
{
System.setProperty("com.android.hierarchyviewer.bindir", "/Users/nju/Downloads/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/");
HierarchyViewerDirector hv=null;

DeviceBridge.terminate();
hv=HierarchyViewerApplicationDirector.createDirector();
hv.initDebugBridge();
//DeviceBridge.initDebugBridge("/Users/nju/Downloads/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb");
hv.populateDeviceSelectionModel();
System.out.println("ADB初始化完成");
try{
Thread.sleep(1000);
}catch(Exception e){
e.printStackTrace();
}
Testtool=new testui();
Testtool.frame.setVisible(true);//这一句报错

UpdateDevices updateThread=new UpdateDevices();
updateThread.start();
}
}

public class testui {

public JFrame frame;
public JTree deviceTree;
public DefaultMutableTreeNode root;
public ArrayList<MyDevice> AllDevices=new ArrayList<MyDevice>();
public DefaultMutableTreeNode selectedNode;
public JLabel numOfDevice;
* Launch the application.
public testui() {
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("自动化测试工具");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setIconImage(new ImageIcon("image/1.jpg").getImage());
frame.setBounds(200, 100, 1000, 600);
}
}

在执行到Testtool.frame.setVisible(true);时输出错误信息:
2015-10-13 20:47:48.876 java[572:26141] Cocoa AWT: Running on AppKit thread 0 when not expected. (
0 liblwawt.dylib 0x000000010c38097a Java_sun_java2d_opengl_CGLLayer_nativeCreateLayer + 119
1 ??? 0x00000001066b8f90 0x0 + 4402679696
)
2015-10-13 20:47:48.877 java[572:26141] Please file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.
2015-10-13 20:47:48.878 java[572:26141] Cocoa AWT: Running on AppKit thread 0 when not expected. (
0 liblwawt.dylib 0x000000010c3895de Java_sun_lwawt_macosx_CPlatformView_nativeCreateView + 169
1 ??? 0x00000001066b8f90 0x0 + 4402679696
)
2015-10-13 20:47:48.878 java[572:26141] Please file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.
2015-10-13 20:47:48.880 java[572:26141] Cocoa AWT: Running on AppKit thread 0 when not expected. (
0 liblwawt.dylib 0x000000010c389976 Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow + 188
1 ??? 0x00000001066b8f90 0x0 + 4402679696
)
……
...全文
590 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Miqiuha 2017-11-04
  • 打赏
  • 举报
回复
啊啊啊,同求,为啥没大神回复?

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧