void resizeMarker(Point point) { Rectangle bounds = new Rectangle(startLocation); bounds.add(point); overlay.setPreferredLocation(bounds.getLocation()); overlay.setPreferredSize(bounds.getSize()); }
if(bounds.contains(p)) { Point b = bounds.getLocation(); Point s = new Point(p.x - b.x, p.y - b.y);
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(); } }
bounds.height = height; final JRootPane rootPane = SwingUtilities.getRootPane(myParent); final Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), rootPane); final Window window = SwingUtilities.getWindowAncestor(myParent); final Point windowPos = window.getLocation();
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); } }
public void finishCreation(boolean aborted) { if (!aborted) { final ScreenMarkerOverlay screenMarkerOverlay = new ScreenMarkerOverlay(currentMarker); screenMarkerOverlay.setPreferredLocation(overlay.getBounds().getLocation()); screenMarkerOverlay.setPreferredSize(overlay.getBounds().getSize()); screenMarkers.add(screenMarkerOverlay); overlayManager.saveOverlay(screenMarkerOverlay); overlayManager.add(screenMarkerOverlay); pluginPanel.rebuild(); updateConfig(); } creatingScreenMarker = false; startLocation = null; currentMarker = null; setMouseListenerEnabled(false); pluginPanel.setCreation(false); }
public @Override Point getLocation() { return bounds.getLocation(); }
public Point getActualLocation() { return actualBounds.getLocation(); }
final Point location = overlay.getBounds().getLocation(); final Dimension dimension = overlay.getBounds().getSize();
/** * Positions this popup to be in the top right-hand corner of the parent * editor. */ private void setLocation() { Point topLeft = textArea.getVisibleRect().getLocation(); SwingUtilities.convertPointToScreen(topLeft, textArea); topLeft.y = Math.max(topLeft.y - 24, 0); setLocation(topLeft.x - LEFT_EMPTY_BORDER, topLeft.y); }
/** * Compute the bounds in which the user can move the mouse without the * tip window disappearing. */ private void computeTipVisibleBounds() { // Compute area that the mouse can move in without hiding the // tip window. Note that Java 1.4 can only detect mouse events // in Java windows, not globally. Rectangle r = tipWindow.getBounds(); Point p = r.getLocation(); SwingUtilities.convertPointFromScreen(p, textArea); r.setLocation(p); tipVisibleBounds.setBounds(r.x,r.y-15, r.width,r.height+15*2); }
/** Recalculates the value of variables realRowCount and * realColumnCount. If the view needs update calls * revalidate. */ private void updateLayoutState() { Dimension d = getSize(); int x = d.width / fixedCellWidth; if (x < 1) { x = 1; } if (x != realColumnCount) { realColumnCount = x; updateLayoutStateNeeded = true; } int y = d.height / fixedCellHeight; if (y != realRowCount) { realRowCount = y; updateLayoutStateNeeded = true; } while ((realRowCount * realColumnCount) < getModel().getSize()) { realRowCount++; } locationToIndex(getVisibleRect().getLocation()); if (updateLayoutStateNeeded) { updateLayoutStateNeeded = false; revalidate(); } }
return; Point p = r.getLocation(); SwingUtilities.convertPointToScreen(p, textArea); r.x = p.x;
@Override public Point getTopLeft () { checkBounds(); return bounds.getLocation(); }
/** * @param table {@link JTable} * @return number of visible rows */ private static int getNumberOfVisibleRows(JTable table) { Rectangle vr = table.getVisibleRect(); int first = table.rowAtPoint(vr.getLocation()); vr.translate(0, vr.height); return table.rowAtPoint(vr.getLocation()) - first; }
public static void convertRectangleToScreen( Rectangle rectangle, Component component ) { Point loc = rectangle.getLocation(); SwingUtilities.convertPointToScreen( loc, component ); rectangle.setLocation( loc ); }
public static void convertRectangleToScreen( Rectangle rectangle, Component component ) { Point loc = rectangle.getLocation(); SwingUtilities.convertPointToScreen( loc, component ); rectangle.setLocation( loc ); }
/** * Positions this popup to be in the top right-hand corner of the parent * editor. */ private void setLocation() { Point topLeft = textArea.getVisibleRect().getLocation(); SwingUtilities.convertPointToScreen(topLeft, textArea); topLeft.y = Math.max(topLeft.y - 24, 0); setLocation(topLeft.x - LEFT_EMPTY_BORDER, topLeft.y); }
public void justify (Widget widget) { Rectangle clientArea = widget.getClientArea (); for (Widget child : widget.getChildren ()) { if (child.isVisible ()) { Point location = child.getPreferredBounds ().getLocation (); child.resolveBounds (new Point (clientArea.x - location.x, clientArea.y - location.y), new Rectangle (location, clientArea.getSize ())); } else { child.resolveBounds (clientArea.getLocation (), new Rectangle ()); } } }
public Rectangle getBoundsToScreen(Rectangle bounds, Component ref) { Point location = bounds.getLocation(); SwingUtilities.convertPointToScreen(location, ref); bounds.setLocation(location); bounds.y += getJMenuBarExtraHeight(); return bounds; }