]> git.mxchange.org Git - addressbook-lib.git/commitdiff
Moved declaration of menu and item instances up as they will be used again
authorRoland Haeder <roland@mxchange.org>
Thu, 23 Jul 2015 13:24:23 +0000 (15:24 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 23 Jul 2015 13:24:23 +0000 (15:24 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java

index 73101004f821c5b3d374aa70bcb080e9a1f3e32b..a8507fb986d96023d8184f05a94ce5ba835e213b 100644 (file)
@@ -205,16 +205,18 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        // Center window in middle of screen, instead of top-left corner
        this.frame.setLocationRelativeTo(null);
 
-       // Init menu bar in north
+       // Init menu bar, menu and item instances
        JMenuBar menuBar = new JMenuBar();
+       JMenu menu;
+       JMenuItem item;
 
        // Init some menus:
        // 1) File menu
-       JMenu menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.file.text"));
+       menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.file.text"));
 
        // Add menu items:
        // 1.x) Exit program (should be last)
-       JMenuItem item = new JMenuItem(this.getBundle().getString("AddressbookFrame.menuItem.exitProgram.text"));
+       item = new JMenuItem(this.getBundle().getString("AddressbookFrame.menuItem.exitProgram.text"));
        item.setToolTipText(this.getBundle().getString("AddressbookFrame.menuItem.exitProgram.toolTipText"));
 
        // Add listener to exit menu
@@ -243,13 +245,13 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        this.statusLabel = new JLabel(this.getBundle().getString("AddressbookFrame.statusLabel.initializing.text"));
 
        // Init status bar in south
-       JPanel statusPanel = new JPanel();
-       statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
-       statusPanel.add(this.statusLabel);
-       statusPanel.setBorder(BorderFactory.createEtchedBorder());
+       JPanel panel = new JPanel();
+       panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+       panel.add(this.statusLabel);
+       panel.setBorder(BorderFactory.createEtchedBorder());
 
        // Add panel to frame
-       this.frame.add(statusPanel, BorderLayout.SOUTH);
+       this.frame.add(panel, BorderLayout.SOUTH);
     }
 
 }