private void positionPanel() { if (parent == null) return; Container scroll = SwingUtilities.getAncestorOfClass(JScrollPane.class, parent); int height = (int)getPreferredSize().getHeight(); if (scroll != null) { Rectangle bounds = scroll.getBounds(); bounds.translate(0, scroll.getHeight() - height); bounds.height = height; Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), oldGlass); bounds.setLocation(pos); setBounds(bounds); repaint(); } }
final int height = (int)getPreferredSize().getHeight(); if (scroll != null) { final Rectangle bounds = scroll.getBounds(); bounds.translate(0, scroll.getHeight() - height); bounds.height = height;
private void positionPanel() { final JComponent contentComponent = myEditor.getContentComponent(); Container scroll = SwingUtilities.getAncestorOfClass(JScrollPane.class, contentComponent); setSize(scroll.getSize()); myLineHeight = myText.getFontMetrics(myText.getFont()).getHeight(); int count = countLines(myText.getText()); int visLines = getSize().height / myLineHeight - 1; int lines = Math.min(count, visLines); setSize(getSize().width, lines * myLineHeight + myLabel.getPreferredSize().height + getBorder().getBorderInsets(this).top * 2); int height = getSize().height; Rectangle bounds = scroll.getBounds(); bounds.translate(0, scroll.getHeight() - height); bounds.height = height; Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), SwingUtilities.getRootPane(contentComponent).getGlassPane()); bounds.setLocation(pos); setBounds(bounds); myScrollPane.getVerticalScrollBar().setValue(0); if (!Options.getInstance().isSet("more")) { // FIX scrollOffset(100000); } else { scrollOffset(0); } }
@Override public void componentResized(ComponentEvent e) { setBounds(contentPane.getBounds()); } });
Container parent = titleLabel.getParent(); parent.scrollRectToVisible(parent.getBounds());
@Override public Insets getAutoscrollInsets() { final Container parent = getParent(); if (parent == null) { return new Insets(0, 0, 0, 0); } final Rectangle outer = getBounds(); final Rectangle inner = parent.getBounds(); return new Insets(inner.y - outer.y + MapView.margin, inner.x - outer.x + MapView.margin, outer.height - inner.height - inner.y + outer.y + MapView.margin, outer.width - inner.width - inner.x + outer.x + MapView.margin); }
private int getPopupFitHeight(Rectangle popupRectInScreen, Component invoker) { if (invoker != null) { Container parent; for (parent = invoker.getParent(); parent != null; parent = parent.getParent()) { if (parent instanceof JFrame || parent instanceof JDialog || parent instanceof JWindow) { return getHeightAdjust(parent.getBounds(), popupRectInScreen); } else if (parent instanceof JApplet || parent instanceof JInternalFrame) { if (popupFrameRect == null) { popupFrameRect = new Rectangle(); } Point p = parent.getLocationOnScreen(); popupFrameRect.setBounds(p.x, p.y, parent.getBounds().width, parent.getBounds().height); return getHeightAdjust(popupFrameRect, popupRectInScreen); } } } return 0; }
private int getPopupFitHeight(Rectangle popupRectInScreen, Component invoker) { if (invoker != null) { Container parent; for (parent = invoker.getParent(); parent != null; parent = parent.getParent()) { if (parent instanceof JFrame || parent instanceof JDialog || parent instanceof JWindow) { return getHeightAdjust(parent.getBounds(), popupRectInScreen); } else if (parent instanceof JApplet || parent instanceof JInternalFrame) { if (popupFrameRect == null) { popupFrameRect = new Rectangle(); } Point p = parent.getLocationOnScreen(); popupFrameRect.setBounds(p.x, p.y, parent.getBounds().width, parent.getBounds().height); return getHeightAdjust(popupFrameRect, popupRectInScreen); } } } return 0; }
private int getPopupFitWidth(Rectangle popupRectInScreen, Component invoker) { if (invoker != null) { Container parent; for (parent = invoker.getParent(); parent != null; parent = parent.getParent()) { if (parent instanceof JFrame || parent instanceof JDialog || parent instanceof JWindow) { return getWidthAdjust(parent.getBounds(), popupRectInScreen); } else if (parent instanceof JApplet || parent instanceof JInternalFrame) { if (popupFrameRect == null) { popupFrameRect = new Rectangle(); } Point p = parent.getLocationOnScreen(); popupFrameRect.setBounds(p.x, p.y, parent.getBounds().width, parent.getBounds().height); return getWidthAdjust(popupFrameRect, popupRectInScreen); } } } return 0; }
public Insets getAutoscrollInsets() { Rectangle outer = getBounds(); Rectangle inner = getParent().getBounds(); return new Insets(inner.y-outer.y+margin, inner.x-outer.x+margin, outer.height-inner.height+margin, outer.width-inner.width+margin); }
public Insets getAutoscrollInsets() { Rectangle outer = getBounds(); Rectangle inner = getParent().getBounds(); return new Insets(inner.y-outer.y+AUTOSCROLL_MARGIN, inner.x-outer.x+AUTOSCROLL_MARGIN, outer.height-inner.height+AUTOSCROLL_MARGIN, outer.width-inner.width+AUTOSCROLL_MARGIN); }
public Insets getAutoscrollInsets() { Rectangle raOuter = getBounds(); Rectangle raInner = getParent().getBounds(); return new Insets(raInner.y - raOuter.y + AUTOSCROLL_MARGIN, raInner.x - raOuter.x + AUTOSCROLL_MARGIN, raOuter.height - raInner.height - raInner.y + raOuter.y + AUTOSCROLL_MARGIN, raOuter.width - raInner.width - raInner.x + raOuter.x + AUTOSCROLL_MARGIN); }
public void layoutContainer(Container parent) { Rectangle b = parent.getBounds(); b.x = 0; b.y = 0; scrollPane.setBounds(b); toolTipPanel.setBounds(b); }
public void layoutContainer(Container parent) { Rectangle b = parent.getBounds(); int inset = 8; int vOffset = 20; int hOffset = 0; int btnWSize = 80; if (parent.getComponentCount() > 1) { JButton btn = (JButton) parent.getComponent(BTN_IDX); int btnHSize = (int) btn.getPreferredSize().getHeight(); btn.setBounds(b.width - inset - btnWSize, vOffset, btnWSize, btnHSize); hOffset = inset + btnWSize; } JComboBox combo = (JComboBox) parent.getComponent(COMBO_IDX); int comboHSize = (int) combo.getPreferredSize().getHeight() + 1; combo.setBounds(inset, vOffset, b.width - 2 * inset - hOffset, comboHSize); } }
@RunsInCurrentThread static @Nonnull Pair<Point, Container> pointAndParentForScrolling(final @Nonnull JTextField textField) { Point origin = new Point(textField.getX(), textField.getY()); Container parent = textField.getParent(); while (parent != null && !(parent instanceof JComponent) && !(parent instanceof CellRendererPane)) { origin = addRectangleToPoint(checkNotNull(parent.getBounds()), origin); parent = parent.getParent(); } return Pair.of(origin, parent); }
public Dimension preferredLayoutSize(Container parent) { Dimension size = preferredNodeSize(getModel(), parent.getBounds()); return sizeWithInsets(parent, size); }
@Override public Rectangle getCaptureRectangle() { Insets insets = getInsets(); Rectangle canvasBounds = Modules.sceDisplayModule.getCanvas().getBounds(); Rectangle contentBounds = getContentPane().getBounds(); return new Rectangle(getX() + insets.left + contentBounds.x + canvasBounds.x, getY() + insets.top + contentBounds.y + canvasBounds.y, canvasBounds.width, canvasBounds.height); }
@Override public void repaint() { Container parent = getParent(); if (parent != null) { Rectangle parentBounds = parent.getBounds(); int parentWidth = parentBounds.width; if (lastParentWidth != parentWidth) { lastParentWidth = parentWidth; int itemsPerRow = parentWidth / itemWidth; setFixedCellWidth(itemWidth + ((parentWidth - itemWidth * itemsPerRow)/ itemsPerRow)); setVisibleRowCount(getComponentCount() / itemsPerRow); } } super.repaint(); } }
@Override public void layoutContainer(Container parent) { currLM.layoutContainer(parent); JRibbonFrame ribbonFrame = JRibbonFrame.this; if (ribbonFrame.getRootPane().getWindowDecorationStyle() != JRootPane.NONE) keyTipLayer .setBounds(ribbonFrame.getRootPane().getBounds()); else keyTipLayer.setBounds(ribbonFrame.getRootPane() .getContentPane().getBounds()); }
public void propertyChange(PropertyChangeEvent evt) { if (toolWindow.getType() == ToolWindowType.FLOATING_LIVE) { if ((Boolean) evt.getNewValue()) { oldBounds = sheet.getBounds(); Rectangle bounds = descriptor.getManager().getMainContainer().getBounds(); bounds = SwingUtilities.convertRectangle(descriptor.getManager().getMainContainer(), bounds, descriptor.getManager().getRootPane().getLayeredPane()); sheet.setBounds(bounds); } else { sheet.setBounds(oldBounds); } SwingUtil.repaint(sheet); } } });