diff --git a/data/gui/msfgui.jar b/data/gui/msfgui.jar index 0935239f19..dc755bdb37 100644 Binary files a/data/gui/msfgui.jar and b/data/gui/msfgui.jar differ diff --git a/external/source/gui/msfguijava/src/msfgui/DraggableTabbedPane.java b/external/source/gui/msfguijava/src/msfgui/DraggableTabbedPane.java index fdb257ebce..9bfc6d5e03 100644 --- a/external/source/gui/msfguijava/src/msfgui/DraggableTabbedPane.java +++ b/external/source/gui/msfguijava/src/msfgui/DraggableTabbedPane.java @@ -23,6 +23,7 @@ import java.util.Set; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuItem; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; @@ -185,8 +186,10 @@ public class DraggableTabbedPane extends JTabbedPane{ //If we got rid of the last tab, close this window, unless it's the main window if(getTabCount() < 1 && MsfguiApp.mainFrame != null //This can be referenced in constructor - && paneParent != MsfguiApp.mainFrame.getFrame()){ + && paneParent != MsfguiApp.mainFrame.getFrame().getContentPane()){ panes.remove(this); + if(paneParent instanceof JPanel) + paneParent = ((JPanel)paneParent).getTopLevelAncestor(); //If parent is a frame, just close it if(paneParent instanceof JFrame){ paneParent.setVisible(false); @@ -428,6 +431,11 @@ public class DraggableTabbedPane extends JTabbedPane{ splitParent.setLeftComponent(split); } splitParent.setDividerLocation(0.5); + }else if (paneParent instanceof JPanel){ + paneParent.removeAll(); + paneParent.setLayout(new java.awt.GridLayout()); + paneParent.add(split); + ((JPanel)paneParent).validate(); } split.setDividerLocation(0.5); paneParent = split; diff --git a/external/source/gui/msfguijava/src/msfgui/MainFrame.java b/external/source/gui/msfguijava/src/msfgui/MainFrame.java index 61659d1f80..a2ccdf1c59 100644 --- a/external/source/gui/msfguijava/src/msfgui/MainFrame.java +++ b/external/source/gui/msfguijava/src/msfgui/MainFrame.java @@ -137,11 +137,13 @@ public class MainFrame extends FrameView { if(!props.containsKey("tabWindowPreference")) props.put("tabWindowPreference", "tab"); if(props.containsKey("tabLayout")){ - java.awt.Container mainPane = getFrame().getContentPane(); Component realigned = DraggableTabbedPane.restoreSplitLayout( - props.get("tabLayout"), getFrame(), (DraggableTabbedPane)tabbedPane); - mainPane.removeAll(); - mainPane.add(realigned); + props.get("tabLayout"), mainPanel, (DraggableTabbedPane)tabbedPane); + if(realigned != null){ + mainPanel.removeAll(); + mainPanel.setLayout(new java.awt.GridLayout()); + mainPanel.add(realigned); + } } MsfFrame.updateSizes(getFrame()); } @@ -445,7 +447,10 @@ nameloop: for (int i = 0; i < names.length; i++) { //First try to connect to the database DbConnectDialog.tryConnect(getFrame(), rpcConn); reloadDb(true); - if(MainFrame.this.closeConsoleMenu.getItemCount() == 0 && !tabbedPane.isEnabledAt(3)){ + //Find a database pane, and see if it is enabled (db successfuly loaded) + DraggableTabbedPane credsDTP = DraggableTabbedPane.getTabPane(credsPane); + if(MainFrame.this.closeConsoleMenu.getItemCount() == 0 && + credsDTP.isEnabledAt(credsDTP.indexOfComponent(credsPane))){ registerConsole( (Map)rpcConn.execute("console.create"), false, ""); reloadDb(true); }