当前位置: 首页>>代码示例>>Java>>正文


Java JComponent.setVisible方法代码示例

本文整理汇总了Java中javax.swing.JComponent.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.setVisible方法的具体用法?Java JComponent.setVisible怎么用?Java JComponent.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JComponent的用法示例。


在下文中一共展示了JComponent.setVisible方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchTab

import javax.swing.JComponent; //导入方法依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TabbedPane.java

示例2: uninstall

import javax.swing.JComponent; //导入方法依赖的package包/类
/** 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:PopupManager.java

示例3: MultiDiffPanelController

import javax.swing.JComponent; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:MultiDiffPanelController.java

示例4: activateFilter

import javax.swing.JComponent; //导入方法依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:DataView.java

示例5: activateSearch

import javax.swing.JComponent; //导入方法依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DataView.java

示例6: IssueTopComponent

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:IssueTopComponent.java

示例7: addWindow

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:StickyWindowSupport.java

示例8: displayObjectInfo

import javax.swing.JComponent; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ManageTags.java

示例9: setControlsVisible

import javax.swing.JComponent; //导入方法依赖的package包/类
/** 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();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:ParameterControlPanel.java

示例10: hideFields

import javax.swing.JComponent; //导入方法依赖的package包/类
private void hideFields (JComponent[] fields) {
    for (JComponent field : fields) {
        field.setVisible(false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:RevisionDialogController.java

示例11: createNoComponent

import javax.swing.JComponent; //导入方法依赖的package包/类
private Component createNoComponent() {
    JComponent noComponent = new JComponent() {};
    noComponent.setSize(0, 0);
    noComponent.setVisible(false);
    return noComponent;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MenuBar.java

示例12: setControlsVisible

import javax.swing.JComponent; //导入方法依赖的package包/类
/** 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);
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:48,代码来源:ControlPanel.java

示例13: setControlsVisible

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
     * 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");
        }
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:72,代码来源:FilterPanel.java

示例14: addToPanel

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
 * Adds a JComponent to the panel.
 *
 * @param component
 */
private void addToPanel(JComponent component) {
    this.add(component);
    component.setVisible(true);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-B,代码行数:10,代码来源:PlayersPanel.java


注:本文中的javax.swing.JComponent.setVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。