/** * Removes the component at the specified index from this popup menu. * * @param pos the position of the item to be removed * @exception IllegalArgumentException if the value of <code>pos</code> < 0, or if the value of * <code>pos</code> is greater than the number of items */ public void remove(int pos) { if (pos < 0) { throw new IllegalArgumentException("index less than zero."); } if (pos > getComponentCount() - 1) { throw new IllegalArgumentException("index greater than the number of items."); } super.remove(pos); }
private void hideWelcomeScreen(JComponent contentPane) { if (myWelcomePane != null) { Disposer.dispose(myWelcomeScreen); contentPane.remove(myWelcomePane); myWelcomeScreen = null; myWelcomePane = null; updateToolbarVisibility(); } }
/** * Runs clean-up for associated resources which need explicit disposal (e.g. listeners keeping * this instance alive because they were added to the model which operationally outlives this * instance). */ public void dispose() { GuiActivator.getUIService().removePluginComponentListener(this); /* * Explicitly remove the components of the PluginComponent instances * because the latter are registered with OSGi and are thus global. */ synchronized (this) { for (PluginComponent pluginComponent : pluginComponents) container.remove((Component) pluginComponent.getComponent()); pluginComponents.clear(); } }
private void removeFromParent() { // Change visibility option opacity = 0f; // Remove file Container container = this.getParent(); if (container != null && container instanceof JComponent) { JComponent parent = (JComponent) container; parent.remove(this); parent.revalidate(); parent.repaint(); } }
/** * Sets current tool windows pane (panel where all tool windows are located). If <code> * toolWindowsPane</code> is <code>null</code> then the method just removes the current tool * windows pane. */ final void setToolWindowsPane(@Nullable final ToolWindowsPane toolWindowsPane) { final JComponent contentPane = (JComponent) getContentPane(); if (myToolWindowsPane != null) { contentPane.remove(myToolWindowsPane); } hideWelcomeScreen(contentPane); myToolWindowsPane = toolWindowsPane; if (myToolWindowsPane != null) { contentPane.add(myToolWindowsPane, BorderLayout.CENTER); } else if (!myApplication.isDisposeInProgress()) { showWelcomeScreen(); } contentPane.revalidate(); }
/** * Sets the content that the popup displays * * @param content A JComponent that represents the content to be displayed. */ public void setContent(JComponent content) { if (content == null) { throw new NullPointerException("Popup content must not be null"); } // Remove the previous popup content if (this.content != null) { glassPane.remove(this.content); } // Set this content to the new content this.content = content; // Set the size of the content this.content.setSize(this.content.getPreferredSize()); // Put the content into the glass pane glassPane.add(this.content); }
/** * Removes the component of a specific <code>PluginComponent</code> from this <code> * PluginContainer</code>. * * @param c the <code>PluginComponent</code> which is to have its component removed from this * <code>PluginContainer</code> */ private synchronized void removePluginComponent(PluginComponent c) { container.remove((Component) c.getComponent()); pluginComponents.remove(c); }
public static void main(String args[]) { JComponent ch = new JComponent() {}; ch.getAccessibleContext(); ch.isFocusTraversable(); ch.setEnabled(false); ch.setEnabled(true); ch.requestFocus(); ch.requestFocusInWindow(); ch.getPreferredSize(); ch.getMaximumSize(); ch.getMinimumSize(); ch.contains(1, 2); Component c1 = ch.add(new Component() {}); Component c2 = ch.add(new Component() {}); Component c3 = ch.add(new Component() {}); Insets ins = ch.getInsets(); ch.getAlignmentY(); ch.getAlignmentX(); ch.getGraphics(); ch.setVisible(false); ch.setVisible(true); ch.setForeground(Color.red); ch.setBackground(Color.red); for (String font : Toolkit.getDefaultToolkit().getFontList()) { for (int j = 8; j < 17; j++) { Font f1 = new Font(font, Font.PLAIN, j); Font f2 = new Font(font, Font.BOLD, j); Font f3 = new Font(font, Font.ITALIC, j); Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j); ch.setFont(f1); ch.setFont(f2); ch.setFont(f3); ch.setFont(f4); ch.getFontMetrics(f1); ch.getFontMetrics(f2); ch.getFontMetrics(f3); ch.getFontMetrics(f4); } } ch.enable(); ch.disable(); ch.reshape(10, 10, 10, 10); ch.getBounds(new Rectangle(1, 1, 1, 1)); ch.getSize(new Dimension(1, 2)); ch.getLocation(new Point(1, 2)); ch.getX(); ch.getY(); ch.getWidth(); ch.getHeight(); ch.isOpaque(); ch.isValidateRoot(); ch.isOptimizedDrawingEnabled(); ch.isDoubleBuffered(); ch.getComponentCount(); ch.countComponents(); ch.getComponent(1); ch.getComponent(2); Component[] cs = ch.getComponents(); ch.getLayout(); ch.setLayout(new FlowLayout()); ch.doLayout(); ch.layout(); ch.invalidate(); ch.validate(); ch.remove(0); ch.remove(c2); ch.removeAll(); ch.preferredSize(); ch.minimumSize(); ch.getComponentAt(1, 2); ch.locate(1, 2); ch.getComponentAt(new Point(1, 2)); ch.isFocusCycleRoot(new Container()); ch.transferFocusBackward(); ch.setName("goober"); ch.getName(); ch.getParent(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); ch.isValid(); ch.isDisplayable(); ch.isVisible(); ch.isShowing(); ch.isEnabled(); ch.enable(false); ch.enable(true); ch.enableInputMethods(false); ch.enableInputMethods(true); ch.show(); ch.show(false); ch.show(true); ch.hide(); ch.getForeground(); ch.isForegroundSet(); ch.getBackground(); ch.isBackgroundSet(); ch.getFont(); ch.isFontSet(); Container c = new Container(); c.add(ch); ch.getLocale(); for (Locale locale : Locale.getAvailableLocales()) ch.setLocale(locale); ch.getColorModel(); ch.getLocation(); boolean exceptions = false; try { ch.getLocationOnScreen(); } catch (IllegalComponentStateException e) { exceptions = true; } if (!exceptions) throw new RuntimeException("IllegalComponentStateException did not occur when expected"); ch.location(); ch.setLocation(1, 2); ch.move(1, 2); ch.setLocation(new Point(1, 2)); ch.getSize(); ch.size(); ch.setSize(1, 32); ch.resize(1, 32); ch.setSize(new Dimension(1, 32)); ch.resize(new Dimension(1, 32)); ch.getBounds(); ch.bounds(); ch.setBounds(10, 10, 10, 10); ch.setBounds(new Rectangle(10, 10, 10, 10)); ch.isLightweight(); ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ch.getCursor(); ch.isCursorSet(); ch.inside(1, 2); ch.contains(new Point(1, 2)); ch.isFocusable(); ch.setFocusable(true); ch.setFocusable(false); ch.transferFocus(); ch.getFocusCycleRootAncestor(); ch.nextFocus(); ch.transferFocusUpCycle(); ch.hasFocus(); ch.isFocusOwner(); ch.toString(); ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); ch.setComponentOrientation(ComponentOrientation.UNKNOWN); ch.getComponentOrientation(); }