// create component loaader
XComponentLoader xCompLoader = (XComponentLoader)
UnoRuntime.queryInterface(
XComponentLoader.class, xMSF.createInstance(
"com.sun.star.frame.Desktop"));
XFramesSupplier xFrameSupp = (XFramesSupplier)UnoRuntime.queryInterface(XFramesSupplier.class, xCompLoader);
// close all existing frames
XFrames xFrames = xFrameSupp.getFrames();
XIndexAccess xAcc = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xFrames);
for ( int i=0; i<xAcc.getCount(); i++ ) {
XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xAcc.getByIndex(i));
try {
if ( xClose != null ) {