public void updateConnectionStatus(boolean connected) { if (connected == true) { headerPanel.setLogoutText(); loginMenuItem.setText("Logout"); } else { headerPanel.setLoginText(); loginMenuItem.setText("Login..."); } mainCommandPanel.updateConnectionStatus(connected); propertiePanel.updateConnectionStatus(connected); cmdConsole.updateConnectionStatus(connected); Iterator iterator = plugins.iterator(); PluginPanel updatePluginPanel = null; while (iterator.hasNext()) { updatePluginPanel = (PluginPanel) iterator.next(); updatePluginPanel.updateConnectionStatus(connected); } if (connected == true) { int selected = tabbedPane.getSelectedIndex(); if (selected >= 2) { ((PluginPanel) pluginPanelMap.get("" + selected)).activated(); } } }
private void buildMenu() { jMenuBar = new javax.swing.JMenuBar(); mainMenu = new javax.swing.JMenu(); mainMenu.setText("Main"); loginMenuItem = new JMenuItem("Login..."); loginMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { headerPanel.handleLoginLogout(); } }); mainMenu.add(loginMenuItem); exitMenuItem = new JMenuItem("Exit"); exitMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { if (qsadminMain.isConnected() == true) { headerPanel.handleLoginLogout(); } System.exit(0); } }); mainMenu.add(exitMenuItem); helpMenu = new javax.swing.JMenu(); helpMenu.setText("Help"); aboutMenuItem = new JMenuItem("About..."); aboutMenuItem.setEnabled(true); aboutMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { about(); } }); helpMenu.add(aboutMenuItem); jMenuBar.add(mainMenu); jMenuBar.add(helpMenu); parentFrame.setJMenuBar(jMenuBar); }