List of usage examples for javax.swing JComponent setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:com.aw.swing.mvp.action.Action.java
public void setVisible(boolean visible) { JComponent jComponent = getJComponent(); if (jComponent != null) { jComponent.setVisible(visible); }//from ww w .ja va2 s. c om }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
protected void createValid() { GridBagConstraints c = new GridBagConstraints(); JComponent label = new JLabel(getDetailsString()); Font f = label.getFont();//w ww . ja v a 2s. c om label.setFont(new Font(f.getName(), Font.BOLD, f.getSize())); c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; DETAILS.add(label, c); JTextArea text = newTextArea(LICENSE.getLicenseDescription(URN)); c.gridwidth = GridBagConstraints.RELATIVE; c.gridheight = 2; c.weighty = 1; c.weightx = .7; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; DETAILS.add(text, c); if (LICENSE.getLicenseDeed(URN) != null) { label = new URLLabel(LICENSE.getLicenseDeed(URN), getDeedString()); } else { label = new JLabel(); label.setVisible(false); } c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.weighty = 0; c.weightx = .3; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(0, 0, 3, 0); DETAILS.add(label, c); label = new URLLabel(LICENSE.getLicenseURI(), getVerificationString()); DETAILS.add(label, c); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopTabSheet.java
protected void updateTabVisibility(TabImpl tab) { // find insert/remove index by visibility of existing tabs int currentIndex = tab.getTabIndex(); int idx = 0;// ww w . ja v a 2s . c o m for (TabImpl t : tabs) { if (t.equals(tab)) break; if (t.isVisible()) idx++; } JComponent comp = DesktopComponentsHelper.getComposition(tab.getComponent()); if (currentIndex >= 0 || tab.isVisible()) { if (tab.isVisible()) { impl.insertTab(tab.getCaption(), null, comp, null, idx); impl.setTabComponentAt(idx, tab.getButtonTabComponent()); } else { impl.removeTabAt(idx); } } else { //tab is detached DetachedFrame detachedFrame = (DetachedFrame) SwingUtilities.getWindowAncestor(comp); detachedFrame.dispose(); } // if we just detach component, it will return isVisible() == true if (!tab.isVisible()) comp.setVisible(false); }
From source file:edu.ku.brc.specify.config.init.MasterUserPanel.java
@Override protected void init(final String title, final String[] fields, final boolean[] required, final String[] types, final Integer[] numColumns) { super.init(title, fields, required, types, numColumns); label = UIHelper.createLabel(" ", SwingConstants.CENTER); createMUBtn = UIHelper.createI18NButton("CREATE_MASTER_BTN"); PanelBuilder tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(createMUBtn, cc.xy(2, 1)); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,2px,p,2px,p")); panelPB.add(tstPB.getPanel(), cc.xy(1, 2)); panelPB.add(getProgressBar(), cc.xy(1, 4)); panelPB.add(label, cc.xy(1, 6));/*from www .ja va 2s .com*/ builder.add(panelPB.getPanel(), cc.xyw(3, row, 2)); row += 2; // Advance part of pane advLabel = UIHelper.createI18NLabel("ADV_MU_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_MU_TEST"); JComponent sep = builder.addSeparator(UIRegistry.getResourceString("ADV_TITLE"), cc.xyw(3, row, 2)); row += 2; builder.add(advLabel, cc.xyw(3, row, 2)); row += 2; tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(skipStepBtn, cc.xy(2, 1)); builder.add(tstPB.getPanel(), cc.xyw(3, row, 2)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createMUBtn.setEnabled(false); skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); createMUBtn.setEnabled(true); skipStepBtn.setEnabled(true); advLabel.setText(UIRegistry.getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); } }); createMUBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createMasterUser(); } }); progressBar.setVisible(false); if (UIRegistry.isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); sep.setVisible(false); } }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
protected void createNotValid() { GridBagConstraints c = new GridBagConstraints(); URI licenseURI = LICENSE.getLicenseURI(); JComponent comp; comp = new JLabel(getWarningIcon()); c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(0, 0, 0, 5); DETAILS.add(comp, c);// w w w.j a v a 2 s . c om String invalidText = getInvalidString(); if (licenseURI != null && allowRetryLink()) invalidText += " " + getRetryString(); comp = newTextArea(invalidText); c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.insets = new Insets(7, 0, 0, 0); DETAILS.add(comp, c); c.gridwidth = 1; c.gridheight = 2; c.weightx = 0; c.weighty = 0; DETAILS.add(javax.swing.Box.createGlue(), c); JButton button = new JButton(getVerifyString()); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { LICENSE.verify(LicenseWindow.this); buildDetails(); } }); button.setVisible(licenseURI != null && allowVerifyLookup()); c.gridwidth = GridBagConstraints.RELATIVE; c.gridheight = 2; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(0, 0, 0, 100); DETAILS.add(button, c); if (LICENSE.getLicenseDeed(URN) == null || !allowClaimedDeedLink()) { comp = new JLabel(); comp.setVisible(false); } else { comp = new URLLabel(LICENSE.getLicenseDeed(URN), getClaimedDeedString()); } c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.BOTH; c.weightx = 0; c.weighty = 0; c.insets = new Insets(0, 0, 3, 0); DETAILS.add(comp, c); if (licenseURI == null || !allowVerificationLink()) { comp = new JLabel(); comp.setVisible(false); } else { comp = new URLLabel(licenseURI, getVerificationString()); } c.insets = new Insets(0, 0, 3, 0); DETAILS.add(comp, c); }
From source file:edu.ku.brc.specify.config.init.DatabasePanel.java
/** * Creates a dialog for entering database name and selecting the appropriate driver. *//*from w w w . j a va 2s . c om*/ @SuppressWarnings("unchecked") public DatabasePanel(final JButton nextBtn, final JButton prevBtn, final String helpContext, final boolean doSetDefaultValues) { super("DATABASE", helpContext, nextBtn, prevBtn); this.doSetDefaultValues = doSetDefaultValues; int t = 0; // for (int p : SKIP_DB_CREATE_PERMS) { // t |= p; // } // PERM_SKIP_DB_CREATE = t; // // t = 0; for (int p : CREATE_DB_PERMS) { t |= p; } PERM_CREATE_DB = t; PERM_SKIP_DB_CREATE = t; //see comments in createSkipDBCreatePerms() createSkipDBCreatePerms(); createCreateDBPerms(); String header = getResourceString("ENTER_DB_INFO") + ":"; CellConstraints cc = new CellConstraints(); String rowDef = "p,2px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", 7) + ",10px,p,10px,p,4px,p,4px,p"; PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p:g", rowDef), this); int row = 1; builder.add(createLabel(header, SwingConstants.CENTER), cc.xywh(1, row, 3, 1)); row += 2; usernameTxt = createField(builder, "IT_USERNAME", true, row); row += 2; passwordTxt = createField(builder, "IT_PASSWORD", true, row, true, null); row += 2; dbNameTxt = createField(builder, "DB_NAME", true, row); row += 2; hostNameTxt = createField(builder, "HOST_NAME", true, row); row += 2; driverList = DatabaseDriverInfo.getDriversList(); drivers = (JComboBox<DatabaseDriverInfo>) createComboBox(driverList); // MySQL as the default drivers.setSelectedItem(DatabaseDriverInfo.getDriver("MySQL")); JLabel lbl = createI18NFormLabel("DRIVER", SwingConstants.RIGHT); lbl.setFont(bold); builder.add(lbl, cc.xy(1, row)); builder.add(drivers, cc.xy(3, row)); row += 2; builder.add(createLabel(" "), cc.xy(1, row)); // spacer row += 2; isStructureOnly = createCheckBox(builder, "CONVUPLD_CHKBX", row); isStructureOnly.setToolTipText(getResourceString("CONVUPLD_CHKBX_TT")); isStructureOnly.setVisible(!UIRegistry.isMobile() && !UIRegistry.isEmbedded()); row += 2; label = UIHelper.createLabel("", SwingConstants.CENTER); createDBBtn = UIHelper.createI18NButton("CREATE_DB"); PanelBuilder tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(createDBBtn, cc.xy(2, 1)); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,2px,p,8px,p")); panelPB.add(tstPB.getPanel(), cc.xy(1, 2)); panelPB.add(getProgressBar(), cc.xy(1, 4)); panelPB.add(label, cc.xy(1, 6)); builder.add(panelPB.getPanel(), cc.xy(3, row)); row += 2; // Advance part of pane advLabel = UIHelper.createI18NLabel("ADV_DB_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_DB_TEST"); JComponent sep = builder.addSeparator(UIRegistry.getResourceString("ADV_TITLE"), cc.xyw(3, row, 1)); row += 2; builder.add(advLabel, cc.xyw(3, row, 1)); row += 2; tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(skipStepBtn, cc.xy(2, 1)); builder.add(tstPB.getPanel(), cc.xyw(3, row, 1)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createDBBtn.setEnabled(false); skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); createDBBtn.setEnabled(true); skipStepBtn.setEnabled(true); advLabel.setText(UIRegistry.getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); } }); createDBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createDB(); } }); if (UIRegistry.isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); sep.setVisible(false); } progressBar.setVisible(false); DocumentAdaptor docAdp = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { updateBtnUI(); } }; usernameTxt.getDocument().addDocumentListener(docAdp); passwordTxt.getDocument().addDocumentListener(docAdp); dbNameTxt.getDocument().addDocumentListener(docAdp); hostNameTxt.getDocument().addDocumentListener(docAdp); updateBtnUI(); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.WorkbenchPaneSS.java
/** * Shows the grid or the form.//from w w w . ja v a 2s . c om * @param value the panel number */ public void showPanel(final PanelType panelType) { checkCurrentEditState(); currentRow = getCurrentIndexFromFormOrSS(); currentPanelType = panelType; cardLayout.show(mainPanel, currentPanelType.toString()); cpCardLayout.show(controllerPane, currentPanelType.toString()); switch (currentPanelType) { case Spreadsheet: formPane.aboutToShowHide(false); // Showing Spreadsheet and hiding form if (model.getRowCount() > 0) { spreadSheet.setRowSelectionInterval(currentRow, currentRow); spreadSheet.setColumnSelectionInterval(0, spreadSheet.getColumnCount() - 1); spreadSheet.scrollToRow(Math.min(currentRow + 4, model.getRowCount())); SwingUtilities.invokeLater(new Runnable() { public void run() { spreadSheet.requestFocus(); } }); } // Enable the "Find" action in the Edit menu when a spreadsheet is shown UIRegistry.enableFind(findPanel, true); // NavBoxMgr.getInstance().adjustSplitter(); ssFormSwitcher.setCurrentIndex(1); break; case Form: // About to Show Form and hiding Spreadsheet // cancel any editing in a cell in the spreadsheet checkCurrentEditState(); // Tell the form we are switching and that it is about to be shown formPane.aboutToShowHide(true); // -1 will tell the form to disable resultsetController.setIndex(model.getRowCount() > 0 ? currentRow : -1); // Hide the find/replace panel when you switch to form view findPanel.getHideFindPanelAction().hide(); // Disable the ctrl-F from the edit menu UIRegistry.disableFindFromEditMenu(); // if(task instanceof SGRTask) // NavBoxMgr.getInstance().closeSplitter(); ssFormSwitcher.setCurrentIndex(0); break; } JComponent[] comps = { addRowsBtn, deleteRowsBtn, clearCellsBtn }; for (JComponent c : comps) { if (c != null) { c.setVisible(currentPanelType == PanelType.Spreadsheet); } } }
From source file:org.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
private JComponent getOrCreateCheckBoxDecoration(InputColumn<?> inputColumn, boolean selected) { DCCheckBox<InputColumn<?>> checkBox = _checkBoxes.get(inputColumn); if (checkBox == null) { final String name = inputColumn.getName(); checkBox = new DCCheckBox<>(name, selected); checkBox.addListener(checkBoxListener); checkBox.setValue(inputColumn);/* w ww.jav a 2 s .c o m*/ _checkBoxes.put(inputColumn, checkBox); } JComponent decoration = _checkBoxDecorations.get(checkBox); if (decoration == null) { decoration = decorateCheckBox(checkBox); _checkBoxDecorations.put(checkBox, decoration); if (inputColumn instanceof MutableInputColumn) { MutableInputColumn<?> mutableInputColumn = (MutableInputColumn<?>) inputColumn; mutableInputColumn.addListener(this); if (mutableInputColumn.isHidden()) { decoration.setVisible(false); } } } return decoration; }
From source file:org.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
@Override public void onVisibilityChanged(MutableInputColumn<?> inputColumn, boolean hidden) { final DCCheckBox<InputColumn<?>> checkBox = getCheckBoxes().get(inputColumn); if (checkBox == null) { return;/*from w ww . j a v a 2 s . c o m*/ } if (checkBox.isSelected()) { // don't hide columns that are selected return; } final JComponent decoration = getCheckBoxDecorations().get(checkBox); if (decoration == null) { return; } decoration.setVisible(!hidden); }
From source file:org.eobjects.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
private JComponent getOrCreateCheckBoxDecoration(InputColumn<?> inputColumn, boolean selected) { DCCheckBox<InputColumn<?>> checkBox = _checkBoxes.get(inputColumn); if (checkBox == null) { final String name = inputColumn.getName(); checkBox = new DCCheckBox<InputColumn<?>>(name, selected); checkBox.addListener(checkBoxListener); checkBox.setValue(inputColumn);//from www.j av a 2 s. c om _checkBoxes.put(inputColumn, checkBox); } JComponent decoration = _checkBoxDecorations.get(checkBox); if (decoration == null) { decoration = decorateCheckBox(checkBox); _checkBoxDecorations.put(checkBox, decoration); if (inputColumn instanceof MutableInputColumn) { MutableInputColumn<?> mutableInputColumn = (MutableInputColumn<?>) inputColumn; mutableInputColumn.addListener(this); if (mutableInputColumn.isHidden()) { decoration.setVisible(false); } } } return decoration; }