try {
Object toolkit = xMultiServiceFactory.createInstance("com.sun.star.awt.Toolkit");
XToolkit toolkit_xToolkit = (XToolkit)UnoRuntime.queryInterface(XToolkit.class, toolkit);
WindowDescriptor windowDescriptor = new WindowDescriptor();
windowDescriptor.Type = WindowClass.TOP;
windowDescriptor.WindowServiceName = "Window";
windowDescriptor.Bounds = new Rectangle(10, 10, 80, 80);
windowDescriptor.WindowAttributes = WindowAttribute.SHOW
| WindowAttribute.BORDER
| WindowAttribute.MOVEABLE
| WindowAttribute.CLOSEABLE;
XWindowPeer window_xWindowPeer = toolkit_xToolkit.createWindow(windowDescriptor);
_window_xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, window_xWindowPeer);
_window_xComponent.addEventListener(this);
XWindow window_xWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, window_xWindowPeer);
window_xWindow.addWindowListener(this);
XTopWindow window_xTopWindow = (XTopWindow)UnoRuntime.queryInterface(
XTopWindow.class, window_xWindow);
window_xTopWindow.addTopWindowListener(this);
windowDescriptor = new WindowDescriptor();
windowDescriptor.Type = WindowClass.SIMPLE;
windowDescriptor.WindowServiceName = "pushButton";
windowDescriptor.Parent = window_xWindowPeer;
windowDescriptor.Bounds = new Rectangle(5, 5, 70, 20);
windowDescriptor.WindowAttributes = WindowAttribute.SHOW;