Java Code Examples for javax.swing.JComponent#removeAll()

The following examples show how to use javax.swing.JComponent#removeAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: bug4337267.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 2
Source File: bug4337267.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 3
Source File: bug4337267.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 4
Source File: bug4337267.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 5
Source File: LocationPaneUI.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public void installUI(JComponent c) {
	if (c != locationPane)
		throw new IllegalArgumentException(
				"this object can only be installed in the component it was constructed with");
	c.removeAll();
	installGUI(c);
}
 
Example 6
Source File: XPOpenLocationPaneUI.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
protected void installGUI(JComponent comp) {
	comp.removeAll();
	comp.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 0;
	c.weighty = 0;
	c.anchor = GridBagConstraints.EAST;
	c.insets = new Insets(5, 5, 5, 5);
	comp.add(new JLabel("Look In:"), c);
	c.gridx++;
	c.weightx = 1;
	c.fill = GridBagConstraints.HORIZONTAL;
	comp.add(new XPDirectoryControls(this), c);

	c.gridy++;
	c.gridx = 0;
	c.weightx = 0;
	c.fill = GridBagConstraints.BOTH;
	c.gridheight = GridBagConstraints.REMAINDER;
	JPanel sidebar = new JPanel();
	sidebar.setBackground(Color.lightGray);
	sidebar.setOpaque(true);
	comp.add(sidebar, c);

	c.gridx++;
	c.fill = GridBagConstraints.BOTH;
	c.weighty = 1;
	c.weightx = 1;
	c.gridheight = 1;
	comp.add(browser, c);

	c.gridy++;
	c.weighty = 0;
	comp.add(new FileControls(), c);
}
 
Example 7
Source File: bug4337267.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 8
Source File: bug4337267.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 9
Source File: bug4337267.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 10
Source File: bug4337267.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 11
Source File: bug4337267.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 12
Source File: bug4337267.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 13
Source File: bug4337267.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 14
Source File: bug4337267.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 15
Source File: bug4337267.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void injectComponent(JComponent p, JComponent c, boolean shape) {
    if (shape) {
        setShaping(c);
    }
    p.removeAll();
    p.add(c);
}
 
Example 16
Source File: MagicDialog.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
private void refreshLayout() {
    final JComponent content = getContentComponent();
    content.removeAll();
    content.add(getDialogCaptionLabel(), "w 100%, h 26!");
    content.add(contentPanel, "w 100%, h 100%");
}
 
Example 17
Source File: NbEditorUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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());
            }
        }
    }
 
Example 18
Source File: MenuEditLayer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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);
    }
}
 
Example 19
Source File: BasicSaveLocationPaneUI.java    From pumpernickel with MIT License 4 votes vote down vote up
@Override
protected final void installGUI(JComponent panel) {
	panel.removeAll();
	panel.revalidate();
	panel.setLayout(new GridBagLayout());

	lowerPanel.removeAll();
	upperPanel.removeAll();

	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 0;
	c.insets = new Insets(20, 20, 3, 20);
	c.fill = GridBagConstraints.NONE;
	c.anchor = GridBagConstraints.CENTER;
	panel.add(upperPanel, c);

	c.gridy++;
	c.gridx = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridwidth = GridBagConstraints.REMAINDER;
	c.weightx = 1;
	c.insets = new Insets(3, 0, 3, 0);
	panel.add(separator, c);
	c.insets = new Insets(3, 3, 3, 3);
	c.gridy++;
	c.weighty = 1;
	c.fill = GridBagConstraints.BOTH;
	panel.add(lowerPanel, c);

	c.gridy++;
	c.weighty = 0;
	panel.add(accessoryPanel, c);
	accessoryPanel.setBorder(new EmptyBorder(new Insets(5, 20, 5, 20)));

	c.weighty = 0;
	c.gridy++;
	c.fill = GridBagConstraints.HORIZONTAL;
	panel.add(footer, c);
	lowerPanel.setBorder(new EmptyBorder(new Insets(0, 20, 0, 20)));

	updateCommitButton();

	populateLowerPanel(lowerPanel);
	populateUpperPanel(upperPanel);

	setExpanded(Preferences.userNodeForPackage(
			BasicSaveLocationPaneUI.class).getBoolean(expandedKey, true));
}
 
Example 20
Source File: AquaOpenLocationPaneUI.java    From pumpernickel with MIT License 4 votes vote down vote up
@Override
protected void installGUI(JComponent panel) {
	panel.addPropertyChangeListener(KEY_INCLUDE_SIDEBAR,
			propertyChangeListener);

	if (sourceList.isEmpty()) {
		File[] array1 = CommonFiles.getUserDirectories(true);
		IOLocation[] array2 = new FileLocation[array1.length];
		for (int a = 0; a < array1.length; a++) {
			array2[a] = LocationFactory.get().create(array1[a]);
		}
		sourceList.add(array2);
	}

	boolean includeSidebar = getBoolean(locationPane, KEY_INCLUDE_SIDEBAR,
			true);
	boolean includeFooter = getBoolean(locationPane, KEY_INCLUDE_FOOTER,
			true);

	panel.removeAll();
	panel.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.insets = new Insets(4, 0, 4, 0);
	panel.add(controls, c);
	c.gridy++;
	c.weighty = 1;
	c.fill = GridBagConstraints.BOTH;

	if (includeSidebar) {
		splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
				sourceListScrollPane, browser);
		panel.add(splitPane, c);
	} else {
		panel.add(browser, c);
	}

	if (includeFooter) {
		c.weighty = 0;
		c.gridy++;
		panel.add(footer, c);
	}
	sourceListScrollPane.setMinimumSize(new Dimension(100, 40));
	sourceListScrollPane.setPreferredSize(new Dimension(150, 40));
}