本文整理匯總了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();
}
示例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);
}
示例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();
}
}
示例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;
}
示例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();
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例9: removeComponentFromParent
import java.awt.Container; //導入方法依賴的package包/類
private void removeComponentFromParent(Component comp)
{
Container container = comp.getParent();
if( container != null )
{
container.remove(comp);
}
}
示例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();
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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();
}
示例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();
}
}