Apache OpenOffice (AOO) Bugzilla – Issue 126752
window can't be closed
Last modified: 2015-12-24 09:11:33 UTC
when I use XToolkit create a window , the window can't be closed. here is the code. public static void main(String[] args) { try { XComponentContext xContext; XMultiComponentFactory xMCF; xContext = Bootstrap.bootstrap(); if (xContext == null) { System.err.println("ERROR: Could not bootstrap default Office."); } xMCF = xContext.getServiceManager(); Object oToolkit = xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", xContext); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, oToolkit); com.sun.star.awt.WindowDescriptor aWindowDescriptor = new com.sun.star.awt.WindowDescriptor(); aWindowDescriptor.Type = WindowClass.TOP; aWindowDescriptor.Bounds = new Rectangle(200,200,800,600); aWindowDescriptor.WindowAttributes =WindowAttribute.MOVEABLE |WindowAttribute.SIZEABLE |WindowAttribute.CLOSEABLE; XWindowPeer xWindowPeer = xToolkit.createWindow(aWindowDescriptor); } catch (java.lang.Exception e){ e.printStackTrace(); } finally { System.exit( 0 ); } }
here is the code. public static void main(String[] args) { try { XComponentContext xContext; XMultiComponentFactory xMCF; xContext = Bootstrap.bootstrap(); if (xContext == null) { System.err.println("ERROR: Could not bootstrap default Office."); } xMCF = xContext.getServiceManager(); Object oToolkit = xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", xContext); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, oToolkit); com.sun.star.awt.WindowDescriptor aWindowDescriptor = new com.sun.star.awt.WindowDescriptor(); aWindowDescriptor.Type = WindowClass.TOP; aWindowDescriptor.Bounds = new Rectangle(200,200,800,600); aWindowDescriptor.WindowAttributes =WindowAttribute.MOVEABLE |WindowAttribute.SIZEABLE |WindowAttribute.CLOSEABLE; XWindowPeer xWindowPeer = xToolkit.createWindow(aWindowDescriptor); XWindow xwindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); xwindow.setVisible(true); } catch (java.lang.Exception e){ e.printStackTrace(); } finally { System.exit( 0 ); } }