public Dimension getSize() { return deviceBounds.getSize(); }
private boolean addHighlight(JTextField label, MouseEvent mouseEvent1, MouseEvent mouseEvent2) { //Two parts: adding the highlight on the label, and scrolling the list appropriately //HighlightUtils handles the first part, we handle the second part here boolean highlightSuccessful = HighlightUtils.addHighlight(label, mouseEvent1, mouseEvent2); FontMetrics fm = label.getFontMetrics(label.getFont()); int firstXpos = mouseEvent1.getX(); int lastXpos = mouseEvent2.getX(); int firstOffset = getCharOffset(fm, label.getText(), firstXpos); int lastOffset = getCharOffset(fm, label.getText(), lastXpos); if(lastOffset != firstOffset) { if(firstOffset > lastOffset) { int tmp = firstOffset; firstOffset = lastOffset; lastOffset = tmp; } Rectangle curVisible = list.getVisibleRect(); if(lastXpos > curVisible.x+curVisible.width) { list.scrollRectToVisible(new Rectangle(new Point(lastXpos-curVisible.width, curVisible.y), curVisible.getSize())); } else if(lastXpos < curVisible.x) { list.scrollRectToVisible(new Rectangle(new Point(lastXpos, curVisible.y), curVisible.getSize())); } list.repaint(); return highlightSuccessful; } else return false; }
graphics.draw(insideStroke); return new Dimension(rectangle.getSize());
Rectangle screenBounds = screensBounds[i]; if (screenBounds.x <= x && x <= (screenBounds.x + screenBounds.width)) { Dimension sizeScreen = screenBounds.getSize(); sizeScreen.height -= 32; // Hack to help prevent menu being clipped by Windows/Linux Taskbar.
void resizeMarker(Point point) { Rectangle bounds = new Rectangle(startLocation); bounds.add(point); overlay.setPreferredLocation(bounds.getLocation()); overlay.setPreferredSize(bounds.getSize()); }
@Override public Dimension render(Graphics2D graphics) { ScreenMarker marker = plugin.getCurrentMarker(); if (marker == null) { return null; } int thickness = marker.getBorderThickness(); int offset = thickness / 2; int width = getBounds().width - thickness; int height = getBounds().height - thickness; graphics.setStroke(createStripedStroke(thickness)); graphics.setColor(marker.getColor()); graphics.drawRect(offset, offset, width, height); return getBounds().getSize(); }
return bounds.getSize();
return newBounds.getSize();
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); }
final Point transformed = OverlayUtil.transformPosition(getPosition(), intersectionRectangle.getSize()); intersectionRectangle.translate(transformed.x, transformed.y);
final Dimension dimension = overlay.getBounds().getSize();
private void init(Element region) { try { robot = new Robot(); } catch (AWTException e1) { e1.printStackTrace(); } content = getJPanel(); _region = region; Rectangle rect = _region.getRectangle(); content.setPreferredSize(rect.getSize()); add(content); setBounds(rect); getRootPane().putClientProperty("Window.shadow", Boolean.FALSE); ((JPanel) getContentPane()).setDoubleBuffered(true); setVisible(false); setFocusableWindowState(false); }
/** * Gets the width and height of this page object encapsulated in a {@link Dimension} object. * @return The dimension object that encapsulates the width and height of this page object. Changing the width * and height of the returned dimension object will not change the width and height of this page object. */ public Dimension getSize() { return new Dimension(bounds.getSize()); }
final Dimension tileSize = ImageUtilities.toTileSize(gridBounds.getSize()); final GridSampleDimension band = GridSampleDimension.wrap(getSampleDimension(VISIBLE_BAND));
setActualSize(rect.getSize()); } else if (mode == VERTICAL){ setActualLocation(rect.x,0);
public static Rectangle getScreenBounds(final GraphicsConfiguration graphicsConfiguration) { final Toolkit defaultToolkit = Toolkit.getDefaultToolkit(); final Insets screenInsets = defaultToolkit.getScreenInsets(graphicsConfiguration); final Rectangle screenBounds = graphicsConfiguration.getBounds(); final Point screenLocation = screenBounds.getLocation(); final Dimension screenSize = screenBounds.getSize(); final int screenWidth = screenSize.width - screenInsets.left - screenInsets.right; final int screenHeight = screenSize.height - screenInsets.top - screenInsets.bottom; return new Rectangle(screenLocation.x + screenInsets.left, screenLocation.y + screenInsets.top, screenWidth, screenHeight); }
private Dimension getScaledTreeSize() { Dimension scaledTreeSize = treeLayout.getBounds().getBounds().getSize(); scaledTreeSize = new Dimension((int)(scaledTreeSize.width*scale), (int)(scaledTreeSize.height*scale)); return scaledTreeSize; }
private Rectangle getTargetBounds(ConnectionWidget connectionWidget) { Widget target = connectionWidget.getTargetAnchor().getRelatedWidget(); if (target == null) return null; Point targetLocation = target.getLocation(); Rectangle targetArea = target.getClientArea(); return new Rectangle(targetLocation, targetArea.getSize()); }
@Override public void addNotify() { super.addNotify(); Dimension textSize = getGraphics().getFontMetrics().getStringBounds("100%", getGraphics()).getBounds().getSize(); Dimension minSize = new Dimension(textSize.width, textSize.height + getInsetHeight()); setPreferredSize(minSize); validate(); }
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 ()); } } }