/** * Creates a new AWT <tt>Container</tt> which can display a single <tt>Component</tt> at a time * (supposedly, one which represents video) and, in the absence of such a <tt>Component</tt>, * displays a predefined default <tt>Component</tt> (in accord with the previous supposition, one * which is the default when there is no video). The returned <tt>Container</tt> will track the * <tt>Components</tt>s added to and removed from it in order to make sure that * <tt>noVideoContainer</tt> is displayed as described. * * @param noVideoComponent the predefined default <tt>Component</tt> to be displayed in the * returned <tt>Container</tt> when there is no other <tt>Component</tt> in it * @return a new <tt>Container</tt> which can display a single <tt>Component</tt> at a time and, * in the absence of such a <tt>Component</tt>, displays <tt>noVideoComponent</tt> */ private VideoContainer createVideoContainer(Component noVideoComponent) { Container oldParent = noVideoComponent.getParent(); if (oldParent != null) oldParent.remove(noVideoComponent); return new VideoContainer(noVideoComponent, false); }
public void run() { try { clientProcess.waitFor(); } catch (InterruptedException ie) { } parent.remove(client); }
public static void setRelativeBounds( @NotNull Component parent, @NotNull Rectangle bounds, @NotNull Component child, @NotNull Container validationParent) { validationParent.add(parent); parent.setBounds(bounds); parent.validate(); child.setLocation(SwingUtilities.convertPoint(child, 0, 0, parent)); validationParent.remove(parent); }
public void propertyChange(PropertyChangeEvent evt) { if (DisplayOptions.isUpdateUIEvent(evt)) { SwingUtilities.updateComponentTreeUI(this); gradientPanel.remove(drawable); JPanel newpanel = createGradientPanel(); contentPane.remove(gradientPanel); gradientPanel = newpanel; gradientPanel.add(drawable, BorderLayout.CENTER); contentPane.add(gradientPanel, BorderLayout.CENTER); } }
public void setParent(JComponent c) { Container oldParent = this.getParent(); oldParent.remove(this); c.add(this); // System.out.println("Switched parents from " + oldParent + " to " + c); }