Dispose one open second window
This commit is contained in:
parent
c1dc50aeaa
commit
26f9f880b5
2 changed files with 22 additions and 15 deletions
|
@ -74,6 +74,7 @@ public class Document {
|
|||
readMetadataInDocument();
|
||||
frame = xDesktop.getCurrentFrame();
|
||||
dispatchProvider = UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class, frame );
|
||||
hideAnnotations();
|
||||
} catch (Exception e) {
|
||||
System.out.println("xDesktop inaccessible. Can not proceed.");
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class EditorGUI extends JFrame {
|
|||
private DefaultTableModel docCustomPropsModel;
|
||||
|
||||
|
||||
//GroupLayouts
|
||||
private static JFrame singleFrame = null;
|
||||
|
||||
|
||||
private Map<String, String> docProps;
|
||||
|
@ -80,22 +80,28 @@ public class EditorGUI extends JFrame {
|
|||
}
|
||||
|
||||
public static void runGUI(Document doc) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (singleFrame != null) {
|
||||
singleFrame.dispose();
|
||||
}
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
EditorGUI frame = new EditorGUI(doc);
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
EditorGUI frame = new EditorGUI(doc);
|
||||
singleFrame = frame;
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static void testGUI() {
|
||||
|
|
Loading…
Add table
Reference in a new issue