From: Roland Haeder Date: Thu, 23 Jul 2015 13:24:23 +0000 (+0200) Subject: Moved declaration of menu and item instances up as they will be used again X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4de3c944d54144fe4ee069fbfdf50a7391f44e84;p=jaddressbook-share-lib.git Moved declaration of menu and item instances up as they will be used again Signed-off-by:Roland Häder --- diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 7310100..a8507fb 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -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); } }