/** * Creates lightweight container for the popup. * * @param owner the owner for this popup container. This parameter is not used in this method. It was there mainly * because the corresponding {@link #createHeavyweightPopupContainer(java.awt.Component)} has this * parameter. * @return a ResizablePanel */ @SuppressWarnings({"UnusedDeclaration"}) protected ResizablePanel createLightweightPopupContainer(Component owner) { ResizablePanel panel = new ResizablePanel() { @Override protected Resizable createResizable() { return new Resizable(this) { @Override public void resizing(int resizeCorner, int newX, int newY, int newW, int newH) { setBounds(newX, newY, newW, newH); } }; } }; panel.setVisible(false); panel.setOpaque(false); panel.setLayout(new BorderLayout()); panel.add(this); return panel; }
/** * Creates the Resizable class. It also set the panel's layout to BorderLayout. */ protected void initComponents() { _resizable = createResizable(); setLayout(new BorderLayout()); }
/** * Gets the border of the resizable window. By default, <code>UIManagerLookup.getBorder("Resizable.resizeBorder")</code> * will be used. * * @return the border. */ public Border getBorder() { return _resizablePanel.getBorder(); }
_panel.remove(this); if (cancelled) { _previousSize = _panel.getSize(); _panel.setVisible(false); Container parent = _panel.getParent(); if (parent != null) { parent.remove(_panel);
_panel.applyComponentOrientation(getComponentOrientation()); if (_panel.isVisible()) { needFireEvents = false; if (!_panel.isVisible()) { packPopup(); _panel.setVisible(true);
/** * Packs the popup. Setting size only if it's a light weight popup. Otherwise do pack. */ public void packPopup() { if (_popupType == LIGHT_WEIGHT_POPUP) { if (_panel == null) { return; } _panel.setSize(_panel.getPreferredSize()); } else if (_popupType == HEAVY_WEIGHT_POPUP) { if (_window == null) { return; } _window.pack(); } }
Point p = getPopupLocation(new Point(x, y), _panel.getSize(), owner); x = p.x; y = p.y; _panel.setLocation(p.x, p.y);
/** * Gets the underlying Resizable. * * @return the Resizable. */ public Resizable getResizable() { return _resizablePanel.getResizable(); }
public Rectangle getPopupBounds() { if (_popupType == LIGHT_WEIGHT_POPUP) { return isPopupVisible() ? _panel.getBounds() : null; } else if (_popupType == HEAVY_WEIGHT_POPUP) { return isPopupVisible() ? _window.getBounds() : null; } return null; }
protected void movePopup() { if (isPopupVisible()) { if (!isDetached() && _actualOwner != null) { if (_insets != null) { showPopup(_insets, _actualOwner); } else if (_actualOwnerLocation != null) { Point newLocation = _actualOwner.getLocationOnScreen(); Point p = null; if (_popupType == LIGHT_WEIGHT_POPUP) { p = _panel.getLocationOnScreen(); } else if (_popupType == HEAVY_WEIGHT_POPUP) { p = _window.getLocationOnScreen(); // light weight popup followed already but heavy weight popup didn't if (p != null) { p.x += newLocation.x - _actualOwnerLocation.x; p.y += newLocation.y - _actualOwnerLocation.y; } } if (p != null) { showPopup(p.x, p.y, _actualOwner); } } } } }
/** * Gets the underlying Resizable. * * @return the Resizable. */ public Resizable getResizable() { return _resizablePanel.getResizable(); }
/** * Gets the underlying Resizable. * * @return the Resizable. */ public Resizable getResizable() { return _resizablePanel.getResizable(); }
/** * Gets the border of the resizable window. By default, <code>UIManagerLookup.getBorder("Resizable.resizeBorder")</code> * will be used. * * @return the border. */ public Border getBorder() { return _resizablePanel.getBorder(); }
/** * Gets the border of the resizable window. By default, <code>UIManagerLookup.getBorder("Resizable.resizeBorder")</code> * will be used. * * @return the border. */ public Border getBorder() { return _resizablePanel.getBorder(); }