本文整理了Java中java.awt.Rectangle.union
方法的一些代码示例,展示了Rectangle.union
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.union
方法的具体详情如下:
包路径:java.awt.Rectangle
类名称:Rectangle
方法名:union
[英]Computes the union of this Rectangle
with the specified Rectangle
. Returns a new Rectangle
that represents the union of the two rectangles
[中]
代码示例来源:origin: RaiMan/SikuliX2
public Element union(Element elem) {
Rectangle r1 = new Rectangle(x, y, w, h);
Rectangle r2 = new Rectangle(elem.x, elem.y, elem.w, elem.h);
return new Element(r1.union(r2));
}
代码示例来源:origin: stackoverflow.com
Rectangle screenRect = new Rectangle(0, 0, 0, 0);
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
screenRect = screenRect.union(gd.getDefaultConfiguration().getBounds());
}
BufferedImage capture = new Robot().createScreenCapture(screenRect);
代码示例来源:origin: RaiMan/SikuliX2
@Override
public String waitForTransition(TransitionListener token) {
this.token = token;
maxR = clickables.get(0).getBounds();
if (clickables.size() > 1) {
for (SxClickable c : clickables.subList(1, clickables.size())) {
maxR = maxR.union(c.getActualBounds());
}
}
setBounds(maxR);
setVisible(true);
mouseTracker.start();
return "Next";
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
Rectangle r = p0.union(p1);
g2d.fillRect(r.x, r.y, r.width, r.height);
代码示例来源:origin: RaiMan/SikuliX2
currentBounds = new Rectangle(gdevs[i].getDefaultConfiguration().getBounds());
if (null != allMonitors) {
allMonitors = allMonitors.union(currentBounds);
} else {
allMonitors = currentBounds;
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Repaint the given line range.
*
* @param line0 The starting line number to repaint. This must
* be a valid line number in the model.
* @param line1 The ending line number to repaint. This must
* be a valid line number in the model.
* @param a The region allocated for the view to render into.
* @param host The component hosting the view (used to call repaint).
*/
protected void damageLineRange(int line0, int line1, Shape a,
Component host) {
if (a != null) {
Rectangle area0 = lineToRect(a, line0);
Rectangle area1 = lineToRect(a, line1);
if ((area0 != null) && (area1 != null)) {
Rectangle dmg = area0.union(area1); // damage.
host.repaint(dmg.x, dmg.y, dmg.width, dmg.height);
}
else {
host.repaint();
}
}
}
代码示例来源:origin: pazone/ashot
@SuppressWarnings("NullableProblems")
@Override
public Coords union(Rectangle r) {
return new Coords(super.union(r));
}
代码示例来源:origin: com.infotel.seleniumRobot/core
/**
* Returns the rectangle of all screens on the system
* @return
*/
private static Rectangle getScreensRectangle() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle screenRect = new Rectangle(0, 0, 0, 0);
for (GraphicsDevice gd : ge.getScreenDevices()) {
screenRect = screenRect.union(gd.getDefaultConfiguration().getBounds());
}
return screenRect;
}
代码示例来源:origin: com.jidesoft/jide-oss
private static Rectangle getScreenBounds() {
Rectangle SCREEN_BOUNDS = new Rectangle();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for (GraphicsDevice gd : gs) {
GraphicsConfiguration gc = gd.getDefaultConfiguration();
SCREEN_BOUNDS = SCREEN_BOUNDS.union(gc.getBounds());
}
return SCREEN_BOUNDS;
}
代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking
private Rectangle getMinorBounds(int majorOrder) {
Rectangle r = new Rectangle();
Rectangle temp = null;
for(int i = 0; i < componentInfos.size(); i++) {
ComponentInfo ci = (ComponentInfo) componentInfos.get(i);
if(ci.constraints.majorOrder == majorOrder) {
temp = ci.comp.getBounds(temp);
r = r.union(temp);
}
}
return r;
}
代码示例来源:origin: geotools/geotools
mappingBB = sourceBB.union(targetBB);
} else {
mappingBB = targetBB;
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
public static Rectangle getVirtualScreenBounds() {
Rectangle virtualBounds = new Rectangle();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for (GraphicsDevice gd : gs) {
GraphicsConfiguration[] gc = gd.getConfigurations();
for (GraphicsConfiguration aGc : gc) {
virtualBounds = virtualBounds.union(aGc.getBounds());
}
}
return virtualBounds;
}
代码示例来源:origin: org.icepdf.os/icepdf-viewer
public void setSelectionSize(Rectangle rect, Component component) {
currentRect = rect;
updateDrawableRect(component.getWidth(), component.getHeight());
Rectangle totalRepaint = rectToDraw.union(previousRectDrawn);
component.repaint(totalRepaint.x, totalRepaint.y,
totalRepaint.width, totalRepaint.height);
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
r = r.union(textArea.modelToView(end));
代码示例来源:origin: com.sikulix/sikulixapi
public ScreenUnion() {
super(true);
_bounds = new Rectangle();
for (int i = 0; i < Screen.getNumberScreens(); i++) {
_bounds = _bounds.union(Screen.getBounds(i));
}
x = _bounds.x;
y = _bounds.y;
w = _bounds.width;
h = _bounds.height;
}
代码示例来源:origin: geotools/geotools
union = union.union(currentExtent);
代码示例来源:origin: Audiveris/audiveris
@Override
public Rectangle getBounds ()
{
Rectangle box = super.getBounds();
if (box != null) {
return box;
}
return new Rectangle(bounds = l1.getBounds().union(l2.getBounds()));
}
代码示例来源:origin: com.synaptix/SynaptixWidget
public void modifyCell(Object value, Rectangle r) {
if (value == null) {
throw new NullArgumentException("value is null");
}
if (!cellMap.containsKey(value)) {
throw new IllegalArgumentException("value not exists");
}
Rectangle rectOld = _removeCell0(value, false);
cellMap.put(value, r);
repaint(getCellRect(r).union(rectOld));
fireValueChanged(new GridCellModelEvent(this, GridCellModelEvent.Type.MODIFY));
}
代码示例来源:origin: Audiveris/audiveris
private boolean canMerge (Filament fil,
Rectangle core,
Section section)
{
// A section must always touch one of fil current member sections
if (!fil.touches(section)) {
return false;
}
// If this does not increase thickness beyond core, it's OK
Rectangle oSct = VERTICAL.oriented(section.getBounds());
return core.union(oSct).height <= core.height;
}
代码示例来源:origin: com.sikulix/sikulixapi
/**
* create a new region containing both regions
*
* @param ur region to unite with
* @return the new region
*/
public Region union(Region ur) {
Rectangle r = getRect().union(ur.getRect());
return Region.create(r.x, r.y, r.width, r.height, scr);
}
内容来源于网络,如有侵权,请联系作者删除!