Java Code Examples for java.awt.Rectangle#setFrame()

The following examples show how to use java.awt.Rectangle#setFrame() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 2
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 3
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 4
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 5
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 6
Source Project: Bytecoder   File: SunGraphics2D.java    License: Apache License 2.0 6 votes vote down vote up
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 7
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 8
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 9
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 10
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 11
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 12
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 13
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 14
public Rectangle getClipBounds(Rectangle r) {
    if (clipState != CLIP_DEVICE) {
        if (transformState <= TRANSFORM_INT_TRANSLATE) {
            if (usrClip instanceof Rectangle) {
                r.setBounds((Rectangle) usrClip);
            } else {
                r.setFrame(usrClip.getBounds2D());
            }
            r.translate(-transX, -transY);
        } else {
            r.setFrame(getClip().getBounds2D());
        }
    } else if (r == null) {
        throw new NullPointerException("null rectangle parameter");
    }
    return r;
}
 
Example 15
Source Project: TFC2   File: IslandMap.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void generateFake()
{
	points.clear();
	edges.clear();
	centers.clear();
	corners.clear();
	lakes.clear();
	rivers.clear();
	caves = new CaveProcessor(this);
	ores = new OreProcessor(this);
	animalProc = new AnimalProcessor(this);
	dungeons.clear();

	points = this.generateHexagon(SIZE);
	Rectangle R = new Rectangle();
	R.setFrame(0, 0, SIZE, SIZE);
	//System.out.println("Starting Creating map Voronoi...");
	Voronoi voronoi = new Voronoi(points, R);
	//System.out.println("Finished Creating map Voronoi...");
	buildGraph(points, voronoi);
}
 
Example 16
Source Project: ramus   File: DataLoader.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static Rectangle readRectangle(final InputStream stream)
        throws IOException {
    final double x = readDouble(stream);
    final double y = readDouble(stream);
    final double w = readDouble(stream);
    final double h = readDouble(stream);
    final Rectangle rec = new Rectangle();
    rec.setFrame(x, y, w, h);
    return rec;
}
 
Example 17
Source Project: TFC2   File: SiteList.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Rectangle getSitesBounds()
{
	if (_sorted == false && _sites != null)
	{
		Collections.sort(_sites, new Site());
		_currentIndex = 0;
		_sorted = true;
	}
	double xmin, xmax, ymin, ymax;
	if (_sites.size() == 0)
	{
		return new Rectangle(0, 0, 0, 0);
	}
	xmin = Integer.MAX_VALUE;
	xmax = Integer.MIN_VALUE;

		for (int i = 0; i < _sites.size(); ++i)
		{
			Site site = _sites.get(i);
		if (site.getX() < xmin)
		{
			xmin = site.getX();
		}
		if (site.getX() > xmax)
		{
			xmax = site.getX();
		}
	}
	// here's where we assume that the sites have been sorted on y:
	ymin = _sites.get(0).getY();
	ymax = _sites.get(_sites.size() - 1).getY();
	
	Rectangle out = new Rectangle();
	out.setFrame(xmin, ymin, xmax - xmin, ymax - ymin);
	
	return out;
}
 
Example 18
Source Project: osp   File: ColorIcon.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Paints the icon.
 *
 * @param c the component on which it is painted
 * @param _g the graphics context
 * @param x the x coordinate of the icon
 * @param y the y coordinate of the icon
 */
public void paintIcon(Component c, Graphics _g, int x, int y) {
  Graphics2D g = (Graphics2D) _g;
  Rectangle rect = new Rectangle(x, y, w, h);
  Paint gPaint = g.getPaint();
  if (outline!=null) {
   g.setPaint(outline);
   g.fill(rect);
  	rect.setFrame(x+lineWidth, y+lineWidth, w-2*lineWidth, h-2*lineWidth);
  }
  g.setPaint(color);
  g.fill(rect);
  // restore graphics paint
  g.setPaint(gPaint);
}