當前位置: 首頁>>代碼示例>>Java>>正文


Java JComponent.removeAll方法代碼示例

本文整理匯總了Java中javax.swing.JComponent.removeAll方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.removeAll方法的具體用法?Java JComponent.removeAll怎麽用?Java JComponent.removeAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JComponent的用法示例。


在下文中一共展示了JComponent.removeAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: uninstallUI

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public void uninstallUI(JComponent c)
{
	uninstallDefaults();
	uninstallListeners();
	this.spinner = null;
	c.removeAll();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:9,代碼來源:FlatterSpinnerUI.java

示例2: injectComponent

import javax.swing.JComponent; //導入方法依賴的package包/類
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:bug4337267.java

示例3: registerForm

import javax.swing.JComponent; //導入方法依賴的package包/類
private void registerForm(final RADVisualContainer metacomp, final JMenu menu) {
    // don't double register
    if(!formModelListeners.containsKey(metacomp)) {
        FormModelListener fml = new FormModelListener() {
            @Override
            public void formChanged(FormModelEvent[] events) {
                if (events != null) {
                    for(FormModelEvent evt : events) {
                        if(evt.getChangeType() == FormModelEvent.FORM_TO_BE_CLOSED) {
                            formModelListeners.remove(metacomp);
                            metacomp.getFormModel().addFormModelListener(this);
                            continue;
                        }
                        
                        if(evt.getChangeType() == FormModelEvent.COMPONENT_PROPERTY_CHANGED) {
                            if("action".equals(evt.getPropertyName())) { // NOI18N
                                configureEditedComponent(evt.getComponent());
                            }
                        }
                        if(evt.getChangeType() == FormModelEvent.COMPONENT_PROPERTY_CHANGED || evt.getChangeType() == FormModelEvent.BINDING_PROPERTY_CHANGED) {
                            if(evt.getContainer() == metacomp || evt.getComponent() == metacomp) {
                                rebuildOnScreenMenu(metacomp);
                            }
                            updateIcon(evt.getComponent());
                        }
                        
                        if(evt.getChangeType() == FormModelEvent.COMPONENT_ADDED) {
                            updateIcon(evt.getComponent());
                            //reinstall the accelerator preview when moving items around
                            if(evt.getComponent() != null) {
                                Component co = (Component) formDesigner.getComponent(evt.getComponent());
                                if(co instanceof JMenuItem) {
                                    installAcceleratorPreview((JMenuItem)co);
                                }
                            }
                        }
                        
                        // if this menu was deleted then make sure it's popup is hidden and removed
                        if(evt.getChangeType() == FormModelEvent.COMPONENT_REMOVED) {
                            if(evt.getComponent() == metacomp) {
                                unconfigureMenu(menu);
                                continue;
                            }
                        }
                        // if something added to the menu we monitor
                        if(evt.getChangeType() == FormModelEvent.COMPONENT_ADDED ||
                                evt.getChangeType() == FormModelEvent.COMPONENTS_REORDERED ||
                                evt.getChangeType() == FormModelEvent.COMPONENT_REMOVED) {
                            if(evt.getContainer() == metacomp) {
                                // then rebuild the menu
                                rebuildOnScreenMenu(metacomp);
                                return;
                            }
                            if(evt.getContainer() == getFormMenuBar()) {
                                JComponent comp = (JComponent) formDesigner.getComponent(getFormMenuBar());
                                if (comp != null) { // MenuBar not shown in the designer, see issue 124873
                                    RADVisualContainer rad = (RADVisualContainer) getFormMenuBar();
                                    comp.removeAll();
                                    for(RADVisualComponent c : rad.getSubComponents()) {
                                        if(c!=null) {
                                            comp.add((JComponent)formDesigner.getComponent(c));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        };
        formModelListeners.put(metacomp,fml);
        metacomp.getFormModel().addFormModelListener(fml);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:75,代碼來源:MenuEditLayer.java

示例4: processSideBars

import javax.swing.JComponent; //導入方法依賴的package包/類
private static void processSideBars(Map sideBars, JComponent ec, JScrollPane scroller) {
        // Remove all existing sidebars
        ec.removeAll();

        // Add the scroller and the new sidebars
        ec.add(scroller);
        scroller.setRowHeader(null);
        scroller.setColumnHeaderView(null);
//        final MouseDispatcher mouse = new MouseDispatcher((JTextComponent) ec.getClientProperty(JTextComponent.class));
        for (Iterator entries = sideBars.entrySet().iterator(); entries.hasNext(); ) {
            Map.Entry entry = (Map.Entry) entries.next();
            SideBarPosition position = (SideBarPosition) entry.getKey();
            JComponent sideBar = (JComponent) entry.getValue();
            
//            if (position.getPosition() == SideBarPosition.WEST) {
//                JPanel p = new JPanel(new BorderLayout()) {
//
//                    @Override
//                    public void addNotify() {
//                        super.addNotify();
//                        infiltrateContainer(this, mouse, true);
//                    }
//
//                    @Override
//                    public void removeNotify() {
//                        infiltrateContainer(this, mouse, false);
//                        super.removeNotify();
//                    }
//
//                };
//                p.add(sideBar, BorderLayout.CENTER);
//                sideBar = p;
//            }
            
            if (position.isScrollable()) {
                if (position.getPosition() == SideBarPosition.WEST) {
                    scroller.setRowHeaderView(sideBar);
                } else {
                    if (position.getPosition() == SideBarPosition.NORTH) {
                        scroller.setColumnHeaderView(sideBar);
                    } else {
                        throw new IllegalArgumentException("Unsupported side bar position, scrollable = true, position=" + position.getBorderLayoutPosition()); // NOI18N
                    }
                }
            } else {
                ec.add(sideBar, position.getBorderLayoutPosition());
            }
        }
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:50,代碼來源:NbEditorUI.java


注:本文中的javax.swing.JComponent.removeAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。