// 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
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);
}
}