List of usage examples for java.awt Container remove
public void remove(Component comp)
From source file:Main.java
public static void replaceComponent(Container cont, int index, Component comp) { cont.remove(index); // cont.validate(); cont.add(comp, index);//from ww w. ja v a 2 s.c o m cont.validate(); cont.repaint(); }
From source file:Main.java
private static void removeButton(Container container) { Component[] components = container.getComponents(); for (Component component : components) { if (component instanceof AbstractButton) { container.remove(component); }//ww w.j a v a 2s. co m } }
From source file:Main.java
public static void replaceComponent(Container cont, Component comp1, Component comp2, String constraints) { int index = -1; int i = 0;/*www .j a v a 2 s.c om*/ for (Component comp : cont.getComponents()) { if (comp.equals(comp1)) { index = i; break; } ++i; } // cont.setIgnoreRepaint(true); cont.remove(comp1); cont.add(comp2, constraints, index); cont.validate(); // cont.setIgnoreRepaint(false); cont.repaint(); }
From source file:BoxLayoutTest.java
public void actionPerformed(ActionEvent evt) { Container contentPane = getContentPane(); contentPane.remove(currentBox); if (horizontalButton.isSelected()) { if (strutsAndGlueCheckBox.isSelected()) { currentBox = horizontalStrutsAndGlueBox; } else {//from w ww.ja v a2 s. c o m currentBox = horizontalBox; } } else { if (strutsAndGlueCheckBox.isSelected()) { currentBox = verticalStrutsAndGlueBox; } else { currentBox = verticalBox; } } contentPane.add(currentBox, "Center"); contentPane.validate(); repaint(); }
From source file:fr.duminy.jbackup.swing.ProgressPanel.java
private void removeFromParent() { final Container parent = getParent(); parent.remove(this); parent.revalidate();/* w w w. j a va2 s. c o m*/ }
From source file:fr.duminy.components.swing.form.JFormPane.java
/** * Remove this form from the given parent container. Other components contained by the container won't be removed. * * @param formContainer The new parent container for this form. */// www .j av a2 s. c o m public void removeFrom(Container formContainer) { formContainer.remove(this); formContainer.revalidate(); }
From source file:misc.TextBatchPrintingDemo.java
/** * Load URL into the current page item. If the cached page item exists for * the given URL, use it; otherwise create new page item. *///from ww w. j av a 2s. c o m void setPage(URL url) { PageItem item = pageCache.get(url); if (item == null) { item = createPageItem(url); pageCache.put(url, item); } if (pageItem != null) { Container p = pageItem.getParent(); if (p != null) { p.remove(pageItem); p.add(item); } } pageItem = item; updateSelectedPages(); }
From source file:com.diversityarrays.update.UpdateDialog.java
/** * Return true to display the dialog/* www . j a v a 2 s . c o m*/ * * @return */ private boolean processReadUrlResult(String updateUrl) { if (kdxploreUpdate == null) { if (RunMode.getRunMode().isDeveloper()) { setResultMessage("<html>Unable to read update information:<br>" + updateUrl); //$NON-NLS-1$ } else { setResultMessage(Msg.ERRMSG_UNABLE_TO_READ_UPDATE_INFO()); } return updateCheckRequest.userCheck; } if (kdxploreUpdate.isError()) { if (!updateCheckRequest.userCheck && kdxploreUpdate.unknownHost) { return false; } setResultMessage(kdxploreUpdate.errorMessage); return true; } // User is checking or we have an update. if (!updateCheckRequest.userCheck) { // Auto check ... if (kdxploreUpdate.versionCode <= updateCheckRequest.versionCode) { // We have the latest setResultMessage(Msg.YOUR_VERSION_IS_THE_LATEST()); return false; } } installUpdateAction.setEnabled(kdxploreUpdate.versionCode > updateCheckRequest.versionCode); closeAction.putValue(Action.NAME, Msg.ACTION_CLOSE()); UpdatePanel updatePanel = new UpdatePanel(updateCheckRequest, kdxploreUpdate, daysToGo); Container cp = getContentPane(); cp.remove(cardPanel); cp.add(updatePanel, BorderLayout.CENTER); pack(); return true; }
From source file:WizardDialog.java
/** * Handles a click on the "previous" button, by displaying the previous panel * in the sequence.//from ww w . j av a 2 s . c o m */ public void previous() { if (this.step > 0) { final WizardPanel previousPanel = getWizardPanel(this.step - 1); // tell the panel that we are returning previousPanel.returnFromLaterStep(); final Container content = getContentPane(); content.remove(this.currentPanel); content.add(previousPanel); this.step = this.step - 1; this.currentPanel = previousPanel; setTitle("Step " + (this.step + 1)); enableButtons(); pack(); } }
From source file:WizardDialog.java
/** * Displays the next step in the wizard sequence. *//*from w ww. ja v a 2 s . com*/ public void next() { WizardPanel nextPanel = getWizardPanel(this.step + 1); if (nextPanel != null) { if (!this.currentPanel.canRedisplayNextPanel()) { nextPanel = this.currentPanel.getNextPanel(); } } else { nextPanel = this.currentPanel.getNextPanel(); } this.step = this.step + 1; if (this.step < this.panels.size()) { this.panels.set(this.step, nextPanel); } else { this.panels.add(nextPanel); } final Container content = getContentPane(); content.remove(this.currentPanel); content.add(nextPanel); this.currentPanel = nextPanel; setTitle("Step " + (this.step + 1)); enableButtons(); pack(); }