eclipse 执行setVisible(true)报错怎么解决?
写了个程序,想通过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
)
……