Issue 126752 - window can't be closed
Summary: window can't be closed
Status: UNCONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 4.1.1
Hardware: All Windows 10
: P5 (lowest) Major
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-24 08:41 UTC by xuesuyu
Modified: 2015-12-24 09:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description xuesuyu 2015-12-24 08:41:46 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 );
        }
    }
Comment 1 xuesuyu 2015-12-24 09:11:33 UTC
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 );
        }
    }