当前位置: 首页>>代码示例>>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;未经允许,请勿转载。