Java Code Examples for javax.swing.JComponent.setVisible()

The following are Jave code examples for showing how to use setVisible() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: TabbedPane.java   View Source Code Vote up 6 votes
private void switchTab( int tabIndex ) {
    if( !tabAdded[tabIndex] ) {
        tabContent.add( tabs[tabIndex], new GridBagConstraints(tabIndex, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0, 0) ); //NOI18N
        tabAdded[tabIndex] = true;
    }
    if( selTabIndex >= 0 ) {
        buttons[selTabIndex].setSelected(false);
    }
    JComponent compToShow = tabs[tabIndex];
    JComponent compToHide = selTabIndex >= 0 ? tabs[selTabIndex] : null;
    selTabIndex = tabIndex;
    buttons[selTabIndex].setSelected(true);

    if( null != compToHide )
        compToHide.setVisible( false );
    
    compToShow.setVisible( true );
    compToShow.requestFocusInWindow();
}
 
Example 2
Project: incubator-netbeans   File: PopupManager.java   View Source Code Vote up 6 votes
/** Removes popup component from textComponent root pane
 *  @param popup popup component to be removed from
 *  root pane of the text component.
 */
public void uninstall(JComponent popup) {
    JComponent oldPopup = this.popup;

    if (oldPopup != null) {
        if (oldPopup.isVisible()) {
            oldPopup.setVisible(false);
        }
        removeFromRootPane(oldPopup);
        this.popup = null;
    }

    if (popup != null && popup != oldPopup) {
        if (popup.isVisible()) {
            popup.setVisible(false);
        }
        removeFromRootPane(popup);
    }
}
 
Example 3
Project: incubator-netbeans   File: MultiDiffPanelController.java   View Source Code Vote up 6 votes
public MultiDiffPanelController (File file, Revision rev1, Revision rev2, int requestedRightLine) {
    this(null, rev1, rev2, true);
    diffViewPanel = new PlaceholderPanel();
    diffViewPanel.setComponent(getInfoPanelLoading());
    this.requestedRightLine = requestedRightLine;
    this.popupAllowed = false;
    replaceVerticalSplitPane(diffViewPanel);
    initToolbarButtons();
    initNextPrevActions();
    for (JComponent c : new JComponent[] { panel.tgbHeadVsIndex, panel.tgbHeadVsWorking, panel.tgbIndexVsWorking }) {
        c.setVisible(false);
    }
    // mimics refreshSetups()
    Setup s = new Setup(file, rev1, rev2, null);
    GitLocalFileNode fNode = new GitLocalFileNode(Git.getInstance().getRepositoryRoot(file), file);
    EditorCookie cookie = DiffUtils.getEditorCookie(s);
    s.setNode(new DiffLocalNode(fNode, s, cookie, Mode.HEAD_VS_WORKING_TREE));
    Map<File, Setup> localSetups = Collections.singletonMap(file, s);
    setSetups(localSetups, getCookiesFromSetups(localSetups));
    setDiffIndex(s, 0, false);
    dpt = new DiffPrepareTask(setups.values().toArray(new Setup[setups.size()]));
    prepareTask = RP.create(dpt);
    prepareTask.schedule(0);
}
 
Example 4
Project: incubator-netbeans   File: DataView.java   View Source Code Vote up 6 votes
public void activateFilter() {
    JComponent panel = getBottomPanel();
    
    if (filterPanel == null) {
        filterPanel = FilterUtils.createFilterPanel(getResultsComponent(), getExcludesFilter(), getFilterOptions());
        panel.add(filterPanel);
        Container parent = panel.getParent();
        parent.invalidate();
        parent.revalidate();
        parent.repaint();
    }
    
    panel.setVisible(true);
    
    filterPanel.setVisible(true);
    filterPanel.requestFocusInWindow();
}
 
Example 5
Project: incubator-netbeans   File: DataView.java   View Source Code Vote up 6 votes
public void activateSearch() {
    JComponent panel = getBottomPanel();
    
    if (searchPanel == null) {
        SearchUtils.TreeHelper searchHelper = getSearchHelper();
        if (searchHelper == null) searchPanel = SearchUtils.createSearchPanel(getResultsComponent(), getSearchOptions());
        else searchPanel = SearchUtils.createSearchPanel((ProfilerTreeTable)getResultsComponent(), searchHelper, getSearchOptions());
        panel.add(searchPanel);
        Container parent = panel.getParent();
        parent.invalidate();
        parent.revalidate();
        parent.repaint();
    }
    
    panel.setVisible(true);
    
    searchPanel.setVisible(true);
    searchPanel.requestFocusInWindow();
}
 
Example 6
Project: incubator-netbeans   File: IssueTopComponent.java   View Source Code Vote up 6 votes
/**
 * Creates new {@code IssueTopComponent}.
 */
public IssueTopComponent() {
    initComponents();
    instanceContent.add(getActionMap());
    associateLookup(new AbstractLookup(instanceContent));
    
    RepositoryRegistry.getInstance().addPropertyChangeListener(this);
    preparingLabel.setVisible(false);
    newButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onNewClick();
        }
    });
    JComponent findBar = FindSupport.create(this).getFindBar();
    findBar.setVisible(false);
    issuePanel.add(findBar, BorderLayout.PAGE_END);
}
 
Example 7
Project: incubator-netbeans   File: StickyWindowSupport.java   View Source Code Vote up 5 votes
/**
 * Add a sticky window to the editor.
 * @param window the JComponent to add to the editor
 */
public void addWindow(JComponent window) {
    Container container = jtc.getParent();
    if(container instanceof JLayeredPane) {
        JLayeredPane pane = (JLayeredPane) container;
        pane.add(window, JLayeredPane.PALETTE_LAYER);
        window.setVisible(true);
    }
}
 
Example 8
Project: incubator-netbeans   File: ManageTags.java   View Source Code Vote up 5 votes
private void displayObjectInfo (boolean visible) {
    for (JComponent comp : new JComponent[] {
        panel.lblTagId, panel.lblTagger, panel.lblTagMessage,
        panel.txtTagId, panel.txtTagger, panel.jScrollPane2
    }) {
        comp.setVisible(visible);
    }
}
 
Example 9
Project: incubator-netbeans   File: MultiDiffPanelController.java   View Source Code Vote up 5 votes
public MultiDiffPanelController (GitFileNode[] files, Mode mode) {
    this(null, Revision.HEAD, Revision.LOCAL, true);
    for (JComponent c : new JComponent[] { panel.tgbHeadVsIndex, panel.tgbHeadVsWorking, panel.tgbIndexVsWorking }) {
        c.setVisible(false);
    }
    this.popupAllowed = false;
    panel.treeSelectionPanel.setVisible(false);
    initFileComponent();
    initToolbarButtons();
    initNextPrevActions();
    changeFiles(files, mode);
    refreshComponents();
}
 
Example 10
Project: jaer   File: ParameterControlPanel.java   View Source Code Vote up 5 votes
/** Set visibility of individual clazz controls; hides other filters.
 * @param visible true to show clazz parameter controls, false to hide this clazz's controls and to show all filters in chain.
 */
public void setControlsVisible(boolean visible) {
    controlsVisible = visible;
    setBorderActive(visible);
    for (JComponent p : controls) {
        p.setVisible(visible);
        p.invalidate();
    }

    invalidate();

}
 
Example 11
Project: incubator-netbeans   File: RevisionDialogController.java   View Source Code Vote up 4 votes
private void hideFields (JComponent[] fields) {
    for (JComponent field : fields) {
        field.setVisible(false);
    }
}
 
Example 12
Project: incubator-netbeans   File: MenuBar.java   View Source Code Vote up 4 votes
private Component createNoComponent() {
    JComponent noComponent = new JComponent() {};
    noComponent.setSize(0, 0);
    noComponent.setVisible(false);
    return noComponent;
}
 
Example 13
Project: jaer   File: ControlPanel.java   View Source Code Vote up 4 votes
/** Set visibility of individual filter controls; hides other filters.
     * @param visible true to show filter parameter controls, false to hide this filter's controls and to show all filters in chain.
     */
    public void setControlsVisible(boolean visible) {
        controlsVisible = visible;
//        getControllable().setSelected(visible); // exposing controls 'selects' this filter
        setBorderActive(visible);
        for (JComponent p : controls) {
            p.setVisible(visible);
            p.invalidate();
        }

        invalidate();
        Container c = getTopLevelAncestor();
        if (c == null) {
            return;
        }
        // TODO fix bug here with enclosed filters not showing up if they are enclosed in enclosed filter, unless they are declared as enclosed
//        if (!getControllable().isEnclosed() && c instanceof Window) {
//            if (c instanceof FilterFrame) {
//                // hide all filters except one that is being modified, *unless* we are an enclosed filter
//                FilterFrame<GeneralController> ff = (FilterFrame) c;
//                for (GeneralController f : ff.filterPanels) {
//                    if (f == this) {  // for us and if !visible
//                        f.setVisible(true); // always set us visible in chain since we are the one being touched
//                        continue;
//                    }
//
//                    f.setVisible(!visible); // hide / show other filters
//                }
//
//            }
//            ((Window) c).pack();
//        }

        if (c instanceof Window) {
            ((Window) c).pack();
        }
//        if(!getControllable().isEnclosed()){ // store last selected top level filter
//            if (visible) {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, getControllable().getClass().toString());
//            } else {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, "");
//            }
//        }
        showControlsToggleButton.setSelected(visible);
    }
 
Example 14
Project: jaer   File: ParameterBrowserPanel.java   View Source Code Vote up 4 votes
/** Set visibility of individual filter controls; hides other filters.
     * @param visible true to show filter parameter controls, false to hide this filter's controls and to show all filters in chain.
     */
    public void setControlsVisible(boolean visible) {
        controlsVisible = visible;
//        getControllable().setSelected(visible); // exposing controls 'selects' this filter
        setBorderActive(visible);
        for (JComponent p : controls) {
            p.setVisible(visible);
            p.invalidate();
        }

        invalidate();
        Container c = getTopLevelAncestor();
        if (c == null) {
            return;
        }
        // TODO fix bug here with enclosed filters not showing up if they are enclosed in enclosed filter, unless they are declared as enclosed
//        if (!getControllable().isEnclosed() && c instanceof Window) {
//            if (c instanceof FilterFrame) {
//                // hide all filters except one that is being modified, *unless* we are an enclosed filter
//                FilterFrame<GeneralController> ff = (FilterFrame) c;
//                for (GeneralController f : ff.filterPanels) {
//                    if (f == this) {  // for us and if !visible
//                        f.setVisible(true); // always set us visible in chain since we are the one being touched
//                        continue;
//                    }
//
//                    f.setVisible(!visible); // hide / show other filters
//                }
//
//            }
//            ((Window) c).pack();
//        }

        if (c instanceof Window) {
            ((Window) c).pack();
        }
//        if(!getControllable().isEnclosed()){ // store last selected top level filter
//            if (visible) {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, getControllable().getClass().toString());
//            } else {
//                getControllable().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, "");
//            }
//        }
        showControlsToggleButton.setSelected(visible);
    }
 
Example 15
Project: jaer   File: FilterPanel.java   View Source Code Vote up 4 votes
/**
     * Set visibility of individual filter controls; hides other filters.
     *
     * @param visible true to show filter parameter controls, false to hide this
     * filter's controls and to show all filters in chain.
     */
    public void setControlsVisible(boolean visible) {
        controlsVisible = visible;
        getFilter().setSelected(visible); // exposing controls 'selects' this filter
        setBorderActive(visible);
        for (JComponent p : controls) {
            p.setVisible(visible);
            p.invalidate();
        }

        boolean globalEnable = false; // For compatibility with new version
        invalidate();
        Container c = getTopLevelAncestor();
        if (c == null) {
            return;
        } else if (c instanceof GlobalViewer) // Added for compatibility with multi-input mode
        {
            c = ((GlobalViewer) c).getFilterPane();
            globalEnable = true;

        }

        // TODO fix bug here with enclosed filters not showing up if they are enclosed in enclosed filter, unless they are declared as enclosed
        if (!getFilter().isEnclosed() && ((c instanceof Window) || globalEnable)) {
            if (c instanceof FilterFrame) {
                // hide all filters except one that is being modified, *unless* we are an enclosed filter
                FilterFrame<FilterPanel> ff = (FilterFrame) c;
                for (FilterPanel f : ff.filterPanels) {
                    if (f == this) {  // for us and if !visible
                        f.setVisible(true); // always set us visible in chain since we are the one being touched
                        continue;
                    }

                    f.setVisible(!visible); // hide / show other filters
                }

            }
//            if (c instanceof Window) // Redundant
//                ((Window) c).pack();

        }

        if (controlPanel != null) {
            controlPanel.setVisible(visible);
        }

//        if (c instanceof Window) {
//            ((Window) c).pack();
//        }
        if (!getFilter().isEnclosed()) { // store last selected top level filter
            if (visible) {
                getFilter().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, getFilter().getClass().toString());
            } else {
                getFilter().getChip().getPrefs().put(FilterFrame.LAST_FILTER_SELECTED_KEY, "");
            }
        }

        if (visible) {
            // Show only controls.
            showControlsToggleButton.setSelected(true);
            showControlsToggleButton.setText("Back to filters list");
        } else {
            showControlsToggleButton.setSelected(false);
            showControlsToggleButton.setText("Controls");
        }
    }
 
Example 16
Project: Progetto-B   File: PlayersPanel.java   View Source Code Vote up 2 votes
/**
 * Adds a JComponent to the panel.
 *
 * @param component
 */
private void addToPanel(JComponent component) {
    this.add(component);
    component.setVisible(true);
}