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


Java Container.remove方法代码示例

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


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

示例1: setViewer

import java.awt.Container; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void setViewer(LayerViewer vv) {
	if (this.vv == vv)
		return;
	this.vv = vv;
	Container contentPane = satellite.getContentPane();

	if (satelliteViewer != null)
		contentPane.remove(satelliteViewer);
	if (vv != null) {
		satelliteViewer = new MySatelliteVisualizationViewer(vv,
				new Dimension(100, 100));

		satelliteViewer.getRenderContext().setVertexFillPaintTransformer(
				vv.getRenderContext().getVertexFillPaintTransformer());

		vv.addChangeListener(satelliteViewer);

		contentPane.add(satelliteViewer);
	} else {
		satelliteViewer = null;
	}
	satellite.pack();
	autoZoomSatellite();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:26,代码来源:SatelliteViewerCorner.java

示例2: removeProjectTab

import java.awt.Container; //导入方法依赖的package包/类
@Override
public void removeProjectTab(ProjectWindowTab projectWindowTab) {

	DefaultMutableTreeNode node = this.getTreeNode(projectWindowTab.getTitle());
	if (node != null) {
		DefaultMutableTreeNode pareNode = (DefaultMutableTreeNode) node.getParent();
		pareNode.remove(node);
	}

	JComponent component = projectWindowTab.getJComponentForVisualization();
	Container container = component.getParent();
	if (container != null) {
		container.remove(component);
	}
	this.tabVector.remove(projectWindowTab);

	this.getTreeModel().reload();
	this.projectTreeExpand2Level(3, true);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:ProjectWindow.java

示例3: stealJToolBarFromOntologyClassEditorJPanel

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Steal the components of a JToolBar for a {@link OntologyClassEditorJPanel}.
 * @param ocep the OntologyClassEditorJPanel
 */
private void stealJToolBarFromOntologyClassEditorJPanel(OntologyClassEditorJPanel ocep) {
	
	if (ocep==null) return;
	if (this.jToolBar4UserFunction==null) return;
	
	JToolBar jToolBarUserFunctions = ocep.getJToolBarUserFunctions();
	if (jToolBarUserFunctions!=null) {
		Container containerUserFunctions = jToolBarUserFunctions.getParent();
		while (jToolBarUserFunctions.getComponentCount()>0) {
			Component comp = jToolBarUserFunctions.getComponent(0);
			this.getStolenComponentsFromJToolBarOfOntologyClassEditorJPanel().add(comp);
			jToolBarUserFunctions.remove(comp);
		}
		if (containerUserFunctions!=null) {
			containerUserFunctions.remove(jToolBarUserFunctions);	
		}
		ocep.validate();
		ocep.repaint();	
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:26,代码来源:DynTableJPanel.java

示例4: preferredLayoutSize

import java.awt.Container; //导入方法依赖的package包/类
@Override
public Dimension preferredLayoutSize(Container parent)
{
	// Move all components to the container and remove the extender button
	parent.remove(extenderButton);

	while( extenderPopup.getComponentCount() > 0 )
	{
		AbstractButton aComponent = (AbstractButton) extenderPopup.getComponent(0);
		extenderPopup.remove(aComponent);
		parent.add(createComponent(aComponent.getAction()));
	}

	// Calculate the width of all components in the container
	Dimension d = new Dimension();
	d.width += parent.getInsets().right + parent.getInsets().left;

	for( int i = 0; i < parent.getComponents().length; i++ )
	{
		d.width += parent.getComponent(i).getPreferredSize().width;
		d.height = Math.max(d.height, parent.getComponent(i).getPreferredSize().height);
	}

	d.height += parent.getInsets().top + parent.getInsets().bottom + 5;
	return d;
}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:ExpandLayout.java

示例5: dockToolBar

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Docks the associated toolbar at the secified edge and indicies.
 */
public void dockToolBar(final int edge, final int row, final int index) {
    final Container target = ourDockLayout.getTargetContainer();
    if (target == null)
        return;

    target.remove(ourToolBar);
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame != null) {
        floatFrame.setVisible(false);
        floatFrame.getContentPane().remove(ourToolBar);
    }

    ourConstraints.setEdge(edge);
    ourConstraints.setRow(row);
    ourConstraints.setIndex(index);

    target.add(ourToolBar, ourConstraints);
    ourToolBarShouldFloat = false;

    target.validate();
    target.repaint();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:26,代码来源:Handler.java

示例6: removeButtons

import java.awt.Container; //导入方法依赖的package包/类
private void removeButtons(AbstractButton... abstractButtons) {
    for (AbstractButton ab : abstractButtons) {
        if (ab != null) {
            Container c = ab.getParent();
            c.remove(ab);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:BasicReplaceResultsPanel.java

示例7: setupProgress

import java.awt.Container; //导入方法依赖的package包/类
private void setupProgress() {
    setIcon(createProgressIcon());
    t = new Timer(100, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Component comp = refComp.get();
            TreeListNode nd = refNode.get();
            if (nd == null && comp == null) {
                t.stop();
                Container p = getParent();
                if (p != null) {
                    p.remove(ProgressLabel.this);
                }
            } else {
                busyIcon.tick();
                ProgressLabel.this.repaint();
                if (nd != null) {
                    nd.fireContentChanged();
                } else {
                    comp.repaint();
                }
            }
        }
    });
    t.setRepeats(true);
    super.setVisible(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ProgressLabel.java

示例8: removeIconHint

import java.awt.Container; //导入方法依赖的package包/类
private void removeIconHint() {
    if (hintIcon != null) {
        Container cont = hintIcon.getParent();
        if (cont != null) {
            Rectangle bds = hintIcon.getBounds();
            cont.remove (hintIcon);
            cont.repaint (bds.x, bds.y, bds.width, bds.height);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:HintsUI.java

示例9: removeComponentFromParent

import java.awt.Container; //导入方法依赖的package包/类
private void removeComponentFromParent(Component comp)
{
	Container container = comp.getParent();
	if( container != null )
	{
		container.remove(comp);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:JStatusBar.java

示例10: hideToolBar

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Hides the associated toolbar by removing it from its dock or by closing
 * its client floating frame.
 */
public void hideToolBar() {
    final Container target = ourDockLayout.getTargetContainer();
    target.remove(ourToolBar);
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame != null) {
        floatFrame.setVisible(false);
        floatFrame.getContentPane().remove(ourToolBar);
    }

    target.validate();
    target.repaint();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:17,代码来源:Handler.java

示例11: floatToolBar

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Floats the associated toolbar at the specified screen location,
 * optionally centering the floating frame on this point.
 */
public void floatToolBar(int x, int y, final boolean center) {
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame == null)
        return;

    final Container target = ourDockLayout.getTargetContainer();
    if (target != null)
        target.remove(ourToolBar);
    floatFrame.setVisible(false);
    floatFrame.getContentPane().remove(ourToolBar);

    ourToolBar.setOrientation(ToolBarLayout.HORIZONTAL);
    floatFrame.getContentPane().add(ourToolBar, BorderLayout.CENTER);
    floatFrame.pack();

    if (center) {
        x -= floatFrame.getWidth() / 2;
        y -= floatFrame.getHeight() / 2;
    }

    // x and y are given relative to screen
    floatFrame.setLocation(x, y);
    floatFrame.setTitle(ourToolBar.getName());
    floatFrame.setVisible(true);

    ourToolBarShouldFloat = true;

    if (target != null) {
        target.validate();
        target.repaint();
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:37,代码来源:Handler.java

示例12: add

import java.awt.Container; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Component add(Component comp, boolean editState) {
    Container oldParent = comp.getParent();
    if (editState) {
        if (comp instanceof UnitLabel) {
            UnitLabel unitLabel = (UnitLabel)comp;
            Unit unit = unitLabel.getUnit();

            if (!unit.isOnCarrier()) {
                igc().putOutsideColony(unit);
            }

            if (unit.getColony() == null) {
                closeColonyPanel();
                return null;
            } else if (!(unit.getLocation() instanceof Tile)
                && !unit.isOnCarrier()) {
                return null;
            }

            oldParent.remove(comp);
            initialize();
            return comp;
        } else {
            logger.warning("Invalid component: " + comp);
            return null;
        }
    } else {
        ((UnitLabel)comp).setSmall(false);
        return add(comp);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:36,代码来源:ColonyPanel.java

示例13: addCargo

import java.awt.Container; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Component addCargo(Component comp, Unit carrier, CargoPanel cargoPanel) {
    Unit unit = ((UnitLabel)comp).getUnit();
    if (carrier.canAdd(unit)) {
        Container oldParent = comp.getParent();
        if (cargoPanel.igc().boardShip(unit, carrier)) {
            ((UnitLabel) comp).setSmall(false);
            if (oldParent != null) oldParent.remove(comp);
            cargoPanel.update();
            return comp;
        }
    }
    return null;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:18,代码来源:UnitLabel.java

示例14: placeToolbar

import java.awt.Container; //导入方法依赖的package包/类
private void placeToolbar() {
	String loc = AppPreferences.TOOLBAR_PLACEMENT.get();
	Container contents = getContentPane();
	contents.remove(toolbar);
	mainPanelSuper.remove(toolbar);
	if (AppPreferences.TOOLBAR_HIDDEN.equals(loc)) {
		; // don't place value anywhere
	} else if (AppPreferences.TOOLBAR_DOWN_MIDDLE.equals(loc)) {
		toolbar.setOrientation(Toolbar.VERTICAL);
		mainPanelSuper.add(toolbar, BorderLayout.WEST);
	} else { // it is a BorderLayout constant
		Object value = BorderLayout.NORTH;
		for (Direction dir : Direction.cardinals) {
			if (dir.toString().equals(loc)) {
				if (dir == Direction.EAST)
					value = BorderLayout.EAST;
				else if (dir == Direction.SOUTH)
					value = BorderLayout.SOUTH;
				else if (dir == Direction.WEST)
					value = BorderLayout.WEST;
				else
					value = BorderLayout.NORTH;
			}
		}

		contents.add(toolbar, value);
		boolean vertical = value == BorderLayout.WEST || value == BorderLayout.EAST;
		toolbar.setOrientation(vertical ? Toolbar.VERTICAL : Toolbar.HORIZONTAL);
	}
	contents.validate();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:32,代码来源:Frame.java

示例15: removeCustomElements

import java.awt.Container; //导入方法依赖的package包/类
/**
 * This method can be used to remove all custom components
 * for menus and for the toolbar.
 */
private void removeCustomElements() {
	
	// --- Remove custom toolbar/menu elements --------
	for (int i = 0; i < customJComponent.size(); i++) {
		JComponent component = customJComponent.get(i);
		Container container = component.getParent();
		if (container!=null) container.remove(component);
	}
	customJComponent = new Vector<JComponent>();
	
	// --- Remove custom tab elements -----------------
	for (int i = customProjectWindowTab.size()-1; i>-1; i--) {
		ProjectWindowTab pwt = customProjectWindowTab.get(i);
		pwt.remove();
	}
	customProjectWindowTab = new Vector<ProjectWindowTab>();
	
	// --- Remove custom environment types ------------
	for (int i = customEnvironmentTypes.size()-1; i>-1; i--) {
		EnvironmentType envType = customEnvironmentTypes.get(i);
		if (envType.equals(this.project.getEnvironmentModelType())) {
			this.project.setEnvironmentModelName("none");
		}
		project.getEnvironmentsComboBoxModel().removeElement(envType);
		Application.getGlobalInfo().removeEnvironmentType(envType);
	}
	customEnvironmentTypes = new Vector<EnvironmentType>();
	
	// --- Remove custom ontology visualizations ------
	for (int i = customOntologyClassVisualisation.size()-1; i>-1; i--) {
		OntologyClassVisualisation ontoClVis = customOntologyClassVisualisation.get(i);
		OntologyVisualisationConfiguration.unregisterOntologyClassVisualisation(ontoClVis);
	}
	customOntologyClassVisualisation = new Vector<OntologyClassVisualisation>();
	
	// --- Refresh the main window --------------------
	if (Application.getMainWindow()!=null) {
		Application.getMainWindow().validate();
		Application.getMainWindow().repaint();
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:47,代码来源:PlugIn.java


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