下面列出了javax.swing.JComponent#removeAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
@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);
}
@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);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
void injectComponent(JComponent p, JComponent c, boolean shape) {
if (shape) {
setShaping(c);
}
p.removeAll();
p.add(c);
}
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);
}
}
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());
}
}
}
private void refreshLayout() {
final JComponent content = getContentComponent();
content.removeAll();
content.add(getDialogCaptionLabel(), "w 100%, h 26!");
content.add(contentPanel, "w 100%, h 100%");
}
@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));
}
@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));
}