List of usage examples for java.awt Component setVisible
public void setVisible(boolean b)
From source file:org.eclipse.wb.internal.swing.utils.SwingImageUtils.java
/** * Set "visible" property of {@link Component} using dispatch thread. * //from w w w . jav a 2 s.c o m * @param component * A {@link Component} which property would be set. * @param visible * A "visible" property value to set. */ static void setVisible(final Component component, final boolean visible) throws Exception { // set "visible" property in AWT Queue SwingUtils.runLaterAndWait(new RunnableEx() { public void run() throws Exception { component.setVisible(visible); if (!visible) { if (EnvironmentUtils.IS_LINUX) { component.removeNotify(); } } } }); }
From source file:org.xulux.swing.util.NativeWidgetHandler.java
/** * @see org.xulux.gui.INativeWidgetHandler#refresh(org.xulux.gui.Widget) *//* ww w .j ava2 s. c o m*/ public void refresh(Object widget) { Component component = (Component) widget; component.setVisible(false); component.setVisible(true); }
From source file:StackLayout.java
/** * ********** Implementation of LayoutManager interface ********* */// w w w . j ava 2s . c o m public void addLayoutComponent(String name, Component comp) { synchronized (comp.getTreeLock()) { comp.setVisible(false); // keep consistency if showComponent was already called on this // component before if (comp == getVisibleComponent()) { visibleComp = null; } /*System.out.println("Border dump for " + comp.getName()); borderDump((javax.swing.JComponent)comp, "");*/ } }
From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.actions.PublishToServerTask.java
public void run() { final MasterReport report = reportDesignerContext.getActiveContext().getContextRoot(); final DocumentMetaData metaData = report.getBundle().getMetaData(); try {/*from w w w. java 2 s . c om*/ final String oldName = extractLastFileName(report); SelectFileForPublishTask selectFileForPublishTask = new SelectFileForPublishTask(uiContext); readBundleMetaData(report, metaData, selectFileForPublishTask); final String selectedReport = selectFileForPublishTask.selectFile(loginData, oldName); if (selectedReport == null) { return; } loginData.setOption("lastFilename", selectedReport); storeBundleMetaData(report, selectedReport, selectFileForPublishTask); reportDesignerContext.getActiveContext().getAuthenticationStore().add(loginData, storeUpdates); final byte[] data = PublishUtil.createBundleData(report); int responseCode = PublishUtil.publish(data, selectedReport, loginData); if (responseCode == 200) { final Component glassPane = SwingUtilities.getRootPane(uiContext).getGlassPane(); try { glassPane.setVisible(true); glassPane.setCursor(new Cursor(Cursor.WAIT_CURSOR)); FileObject fileSystemRoot = PublishUtil.createVFSConnection(loginData); final JCRSolutionFileSystem fileSystem = (JCRSolutionFileSystem) fileSystemRoot.getFileSystem(); fileSystem.getLocalFileModel().refresh(); } catch (Exception e1) { UncaughtExceptionsModel.getInstance().addException(e1); } finally { glassPane.setVisible(false); glassPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } if (JOptionPane.showConfirmDialog(uiContext, Messages.getInstance().getString("PublishToServerAction.Successful.LaunchNow"), Messages.getInstance().getString("PublishToServerAction.Successful.LaunchTitle"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { PublishUtil.launchReportOnServer(loginData.getUrl(), selectedReport); } } else if (responseCode == 403) { logger.error("Publish failed. Server responded with status-code " + responseCode); JOptionPane.showMessageDialog(uiContext, Messages.getInstance().getString("PublishToServerAction.FailedAccess"), Messages.getInstance().getString("PublishToServerAction.FailedAccessTitle"), JOptionPane.ERROR_MESSAGE); } else { logger.error("Publish failed. Server responded with status-code " + responseCode); showErrorMessage(); } } catch (Exception exception) { logger.error("Publish failed. Unexpected error:", exception); showErrorMessage(); } }
From source file:edu.ku.brc.specify.datamodel.busrules.InstitutionBusRules.java
@Override public void initialize(final Viewable viewableArg) { super.initialize(viewableArg); if (formViewObj != null && formViewObj.getMVParent().isTopLevel()) { ResultSetController rsc = formViewObj.getRsController(); if (rsc != null) { if (rsc.getNewRecBtn() != null) rsc.getNewRecBtn().setVisible(false); if (rsc.getDelRecBtn() != null) rsc.getDelRecBtn().setVisible(false); }//from ww w .j av a 2 s.c o m ValSpinner minPwdLenSpinner = (ValSpinner) formViewObj.getControlById("minimumPwdLength"); if (minPwdLenSpinner != null) { minPwdLenSpinner.setRange(Institution.MIN_PASSWORD_LEN, // min 30, // max Institution.MIN_PASSWORD_LEN); // val } if (!AppPreferences.getLocalPrefs().getBoolean("RELEASE_MANAGER", false)) { Component comp = formViewObj.getControlById("relmgrsep"); if (comp != null) comp.setVisible(false); comp = formViewObj.getControlById("relmgrlabel"); if (comp != null) comp.setVisible(false); comp = formViewObj.getControlById("relmgrpanel"); if (comp != null) comp.setVisible(false); } } }
From source file:client.gui.ButtonPanel.java
public void hideAll() { for (final Component c : getComponents()) { if (c instanceof JButton) { c.setVisible(false); }//from w w w. j a v a2 s.c o m } }
From source file:StackLayout.java
/** * Set the currently displayed component. If passed null for the component, * all contained components will be made invisible (sliding windows do this) * @param c Component to show/* www.jav a 2s. co m*/ * @param parent Parent container */ public void showComponent(Component c, Container parent) { Component comp = getVisibleComponent(); if (comp != c) { if (!parent.isAncestorOf(c) && c != null) { parent.add(c); } synchronized (parent.getTreeLock()) { if (comp != null) { comp.setVisible(false); } visibleComp = new WeakReference<Component>(c); if (c != null) { c.setVisible(true); } // trigger re-layout if (c instanceof JComponent) { ((JComponent) c).revalidate(); } else { parent.validate(); //XXX revalidate should work! } } } }
From source file:client.gui.ButtonPanel.java
public void showButton(final String button) { for (final Component c : getComponents()) { if (c instanceof JButton && ((JButton) c).getText().equals(button)) { c.setVisible(true); }// ww w. ja v a 2 s.co m } }
From source file:com.googlecode.vfsjfilechooser2.accessories.connection.ConnectionDialog.java
private void enableFields(boolean b) { Component[] components = { hostnameLabel, hostnameTextField, usernameLabel, usernameTextField, passwordLabel, passwordTextField, portLabel, portTextField }; for (Component component : components) { component.setVisible(b); }// ww w .j a v a 2 s .c om }
From source file:StackLayout.java
public void removeLayoutComponent(Component comp) { synchronized (comp.getTreeLock()) { if (comp == getVisibleComponent()) { visibleComp = null;//from w ww .j av a 2s .co m } // kick out removed component as visible, so that others // don't have problems with hidden components comp.setVisible(true); } }