List of usage examples for java.awt Component setVisible
public void setVisible(boolean b)
From source file:edu.ku.brc.specify.datamodel.busrules.AgentBusRules.java
/** * Clears the values and hides somAttachmentOwnere UI depending on what type is selected * @param cbx the type cbx// ww w . ja v a 2 s . com */ protected void fixUpTypeCBX(final JComboBox<?> cbx) { if (formViewObj != null) { Agent agent = (Agent) formViewObj.getDataObj(); if (agent != null) { final Component addrSubView = formViewObj.getCompById("9"); boolean isVisible = addrSubView.isVisible(); byte agentType = (byte) cbx.getSelectedIndex(); if (agentType != Agent.PERSON) { agent.setMiddleInitial(null); agent.setFirstName(null); agent.setTitle(null); boolean enable = agentType == Agent.ORG; addrSubView.setVisible(enable); } else { if (!isVisible) { SwingUtilities.invokeLater(new Runnable() { public void run() { Component topComp = UIHelper.getWindow(addrSubView); Component topMost = UIRegistry.getTopWindow(); if (topComp != topMost && topComp != null) { ((Window) topComp).pack(); } } }); } addrSubView.setVisible(true); } agent.setAgentType(agentType); fixUpFormForAgentType(agent, true); } } }
From source file:com.mirth.connect.plugins.httpauth.HttpAuthConnectorPropertiesPanel.java
private void authTypeChanged() { AuthType authType = (AuthType) typeComboBox.getSelectedItem(); if (!forceAuthTypeChange) { if (!getProperties(selectedAuthType).equals(getDefaultProperties(selectedAuthType))) { if (!PlatformUI.MIRTH_FRAME.alertOkCancel(PlatformUI.MIRTH_FRAME, "The current HTTP authentication properties will be lost. Are you sure you want to continue?")) { typeComboBox.setSelectedItem(selectedAuthType); return; }//w w w. java 2 s . c o m } PlatformUI.MIRTH_FRAME.setSaveEnabled(true); } basicRealmLabel.setVisible(false); basicRealmField.setVisible(false); basicCredentialsLabel.setVisible(false); basicCredentialsPanel.setVisible(false); jsScriptLabel.setVisible(false); jsScriptField.setVisible(false); customClassNameLabel.setVisible(false); customClassNameField.setVisible(false); customPropertiesLabel.setVisible(false); customPropertiesPanel.setVisible(false); digestRealmLabel.setVisible(false); digestRealmField.setVisible(false); digestAlgorithmLabel.setVisible(false); digestAlgorithmMD5Radio.setVisible(false); digestAlgorithmMD5SessRadio.setVisible(false); digestAlgorithmBothRadio.setVisible(false); digestQOPLabel.setVisible(false); digestQOPAuthCheckBox.setVisible(false); digestQOPAuthIntCheckBox.setVisible(false); digestOpaqueLabel.setVisible(false); digestOpaqueField.setVisible(false); digestCredentialsLabel.setVisible(false); digestCredentialsPanel.setVisible(false); oauth2TokenLabel.setVisible(false); oauth2TokenLocationComboBox.setVisible(false); oauth2TokenField.setVisible(false); oauth2VerificationURLLabel.setVisible(false); oauth2VerificationURLField.setVisible(false); if (connectorPropertiesPanel != null && connectorPropertiesPanel.getLayoutComponents() != null) { for (Component[] row : connectorPropertiesPanel.getLayoutComponents()) { for (Component column : row) { column.setVisible(false); } } } if (authType == AuthType.BASIC) { basicRealmLabel.setVisible(true); basicRealmField.setVisible(true); basicCredentialsLabel.setVisible(true); basicCredentialsPanel.setVisible(true); } else if (authType == AuthType.DIGEST) { digestRealmLabel.setVisible(true); digestRealmField.setVisible(true); digestAlgorithmLabel.setVisible(true); digestAlgorithmMD5Radio.setVisible(true); digestAlgorithmMD5SessRadio.setVisible(true); digestAlgorithmBothRadio.setVisible(true); digestQOPLabel.setVisible(true); digestQOPAuthCheckBox.setVisible(true); digestQOPAuthIntCheckBox.setVisible(true); digestOpaqueLabel.setVisible(true); digestOpaqueField.setVisible(true); digestCredentialsLabel.setVisible(true); digestCredentialsPanel.setVisible(true); } else if (authType == AuthType.JAVASCRIPT) { jsScriptLabel.setVisible(true); jsScriptField.setVisible(true); } else if (authType == AuthType.CUSTOM) { customClassNameLabel.setVisible(true); customClassNameField.setVisible(true); customPropertiesLabel.setVisible(true); customPropertiesPanel.setVisible(true); } else if (authType == AuthType.OAUTH2_VERIFICATION) { oauth2TokenLabel.setVisible(true); oauth2TokenLocationComboBox.setVisible(true); oauth2TokenField.setVisible(true); oauth2VerificationURLLabel.setVisible(true); oauth2VerificationURLField.setVisible(true); if (connectorPropertiesPanel != null && connectorPropertiesPanel.getLayoutComponents() != null) { for (Component[] row : connectorPropertiesPanel.getLayoutComponents()) { for (Component column : row) { column.setVisible(true); } } } } setProperties(connectorPanel.getDefaults(), getDefaultProperties(authType)); selectedAuthType = authType; }
From source file:org.datacleaner.windows.AnalysisJobBuilderWindowImpl.java
private void setEditingView(JComponent component) { final Component[] components = _editingContentView.getComponents(); for (Component existing : components) { if (component == existing) { existing.setVisible(true); } else {/* ww w. j av a 2s . c om*/ existing.setVisible(false); } } _editingContentView.add(component, BorderLayout.CENTER); _editingContentView.updateUI(); }
From source file:org.broad.igv.hic.MainWindow.java
public Component showGlassPane() { final Component glassPane = getGlassPane(); glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); glassPane.setVisible(true); return glassPane; }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Centers the specified component on the screen and then makes it visible. * This method is mainly useful for windows, frames and dialogs. * //from w w w .j a v a 2 s .c o m * @param window The component to center. * @see #centerOnScreen(Component) */ public static void centerAndShow(Component window) { centerOnScreen(window); window.setVisible(true); }
From source file:org.broad.igv.hic.MainWindow.java
/** * Untility function to execute a task in a worker thread. The method is on MainWindow because the glassPane * is used to display a wait cursor and block events. * * @param runnable//from w ww .j a v a2s.c om * @return */ public Future executeLongRunningTask(final Runnable runnable) { Callable<Object> wrapper = new Callable<Object>() { public Object call() throws Exception { final Component glassPane = showGlassPane(); try { runnable.run(); return "done"; } finally { glassPane.setVisible(false); } } }; return threadExecutor.submit(wrapper); }
From source file:edu.ku.brc.ui.UIRegistry.java
/** * //from w ww .j a v a 2s. c o m */ public synchronized static void clearSimpleGlassPaneMsg() { if (oldGlassPane != null) { ((JFrame) UIRegistry.getTopWindow()).setGlassPane(oldGlassPane); oldGlassPane.setVisible(false); } else { Component glassPane = ((JFrame) UIRegistry.getTopWindow()).getGlassPane(); if (glassPane != null) { glassPane.setVisible(false); } } oldGlassPane = null; showingGlassPane = false; }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Sets the location of the passed component relative to the specified * bounds./* w w w . j a v a2s . c o m*/ * * @param bounds The bounds of the main component. * @param child The location of the child */ public static void incrementRelativeToAndShow(Rectangle bounds, Component child) { if (bounds == null) { UIUtilities.centerAndShow(child); return; } child.setLocation(bounds.x + INCREMENT, bounds.y + INCREMENT); child.setVisible(true); }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Shows the specified window on the screen, It will appear at the specified * location. If the location is <code>null</code>, it will appear in the * middle of the screen. /* ww w. j av a2 s . c om*/ * * @param window The component to show. * @param location The location of the specified component if * <code>null</code> it will appear in the middle of the * screen. */ public static void showOnScreen(Component window, Point location) { if (window == null) return; if (location == null) centerOnScreen(window); else { window.setLocation(location); window.setVisible(true); } }
From source file:net.schweerelos.parrot.CombinedParrotApp.java
@SuppressWarnings("serial") private JToggleButton setupNavigatorButton(final String name, final String accelerator, final NavigatorComponent navigator) { final Component component = navigator.asJComponent(); AbstractAction showNavigatorAction = new AbstractAction(name) { @Override/*w ww . jav a 2 s . c o m*/ public void actionPerformed(ActionEvent e) { if (!(e.getSource() instanceof JToggleButton)) { return; } final Window window; if (component instanceof Window) { window = (Window) component; } else { window = SwingUtilities.getWindowAncestor(component); } JToggleButton button = (JToggleButton) e.getSource(); boolean show = button.isSelected(); if (show) { if (window != CombinedParrotApp.this && preferredFrameLocations.containsKey(window)) { window.setLocation(preferredFrameLocations.get(window)); } } if (navigator.tellSelectionWhenShown()) { Collection<NodeWrapper> selectedNodes = activeMainView.getSelectedNodes(); navigator.setSelectedNodes(selectedNodes); } component.setVisible(show); if (show) { window.setVisible(true); } else if (window != CombinedParrotApp.this) { window.setVisible(false); } } }; showNavigatorAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control " + accelerator)); final JToggleButton button = new JToggleButton(showNavigatorAction); button.setToolTipText("Show " + name.toLowerCase()); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button.setToolTipText((button.isSelected() ? "Hide " : "Show ") + name.toLowerCase()); } }); final Window window; if (component instanceof Window) { window = (Window) component; } else { window = SwingUtilities.getWindowAncestor(component); } if (window != null) { window.addComponentListener(new ComponentAdapter() { @Override public void componentHidden(ComponentEvent e) { button.setSelected(false); if (window != CombinedParrotApp.this) { preferredFrameLocations.put(window, window.getLocation()); } } @Override public void componentShown(ComponentEvent e) { button.setSelected(true); } }); } return button; }