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(); } } }
// Tab listener public void stateChanged(ChangeEvent e) { int curTab = partTabbedPane.getSelectedIndex(); if (curTab == 0) { System.out.println("part gen state changed : display = true"); particleSizeInputPanel.setVisibleDisplayFrame(true); } else { System.out.println("part gen state changed : display = false"); particleLocGenPanel.setVisibleDisplayFrame(true); } }
protected WMSPanel addNewPanel(final JTabbedPane tabPane) { final WMSPanel wmsPanel = new WMSPanel(null); // the null indicates not to register the panel wmsPanel.initialize(this.controller); wmsPanel.getJPanel().putClientProperty("WMS_PANEL", wmsPanel); tabPane.putClientProperty(wmsPanel.getURLString(), wmsPanel); tabPane.addTab("New Server", wmsPanel.getJPanel()); tabPane.setSelectedIndex(tabPane.getTabCount() - 1); tabPane.setToolTipTextAt(tabbedPane.getSelectedIndex(), "Server WMS Contents"); wmsPanel.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("NewServer")) { String serverLocation = (String) evt.getNewValue(); if (WWUtil.isEmpty(serverLocation)) return; // // // Check to see if it's already open. // for (int i = 0; i < tabbedPane.getTabCount(); i++) // { // JPanel jp = (JPanel) tabbedPane.getTabComponentAt(i); // if (jp != null) // { // WMSPanel wp = (WMSPanel) // jp.getClientProperty("WMS_PANEL"); // if (wp != null && // wp.getURLString().equalsIgnoreCase(serverLocation)) // { // tabbedPane.setSelectedIndex(i); // make it the // visible one // return; // } // } // } try { addNewPanel(tabPane).contactWMSServer(serverLocation); } catch (URISyntaxException e) { e.printStackTrace(); // TODO } } } }); return wmsPanel; }
/* * Tab has changed. Focus on saved component for the given tab. * When there is no saved component, focus on the first component. */ public void stateChanged(ChangeEvent e) { Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex()); if (key == null) return; Component value = tabFocus.get(key); // First time selecting this tab or focus policy is RESET_FOCUS if (value == null) { key.transferFocus(); tabFocus.put(key, value); } else // Use the saved component for focusing { value.requestFocusInWindow(); } }
public void stateChanged(ChangeEvent ce) { Object ob = ce.getSource(); Class<?> cl = ob.getClass(); if (Debug) { System.out.println("MyChangeListener: got stateChanged: Object: " + ob.toString() + "\n"); System.out.println("MyChangeListener: got stateChanged: Class: " + cl.getName() + "\n"); } if (cl.getName().equals("javax.swing.JTabbedPane")) { if (pane == ce.getSource()) { int index = pane.getSelectedIndex(); mLook.stateChanged(index); } else { System.out.println("The source does NOT equal pane\n"); } } }
/* * Track focus changes and update the current focus component * for the current tab */ public void propertyChange(PropertyChangeEvent e) { // No need to track focus change if (exceptions == null && focusPolicy == RESET_FOCUS) return; // Check for exceptions to the focus policy exist Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex()); if (exceptions != null) { if (focusPolicy == RESET_FOCUS && !exceptions.contains(key)) return; if (focusPolicy == RETAIN_FOCUS && exceptions.contains(key)) return; } // Track focus changes for the tab Component value = (Component) e.getNewValue(); if (value != null && SwingUtilities.isDescendingFrom(value, key)) { tabFocus.put(key, value); } }
public int getSelectedTab() { return tabbedPane.getSelectedIndex(); }
/** * Return the ParamDefaultsTable which is currently being shown in the tabbed pane * * @return The current ParamDefaultsTable */ public ParamDefaultsTable getCurrentTable() { int index = tableTabbedPane.getSelectedIndex(); return (ParamDefaultsTable) myTables.get(index); }
void printfTabPane_stateChanged(ChangeEvent e) { updateEditableTemplate(selectedPane); selectedPane = printfTabPane.getSelectedIndex(); updatePane(selectedPane); }
public void testViewChanged() { TestRunView view = (TestRunView) fTestRunViews.elementAt(fTestViewTab.getSelectedIndex()); view.activate(); }