List of usage examples for java.awt Rectangle setRect
public void setRect(double x, double y, double width, double height)
From source file:Main.java
public static void getComponentRect(Point locationOnScreen, Component component, Rectangle resultStorage) { Dimension size = component.getSize(); resultStorage.setRect(locationOnScreen.x, locationOnScreen.y, size.width, size.height); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Rectangle r = new Rectangle(10, 10, 50, 40); r.setRect(20, 20, 40, 40); g2.fill(r);//from w ww. ja va2 s . c om }
From source file:org.pentaho.reporting.libraries.designtime.swing.LibSwingUtil.java
public static Rectangle parseRectangle(final String boundsAsText) { try {/*from www . j ava 2 s. com*/ final StringTokenizer tokenizer = new StringTokenizer(boundsAsText, ","); if (tokenizer.countTokens() == 4) { final double x = Double.parseDouble(tokenizer.nextToken()); final double y = Double.parseDouble(tokenizer.nextToken()); final double width = Double.parseDouble(tokenizer.nextToken()); final double height = Double.parseDouble(tokenizer.nextToken()); final Rectangle rectangle = new Rectangle(); rectangle.setRect(x, y, width, height); return rectangle; } return null; } catch (Exception e) { logger.warn("Error while getting initial frame bounds.", e); // NON-NLS return null; } }