当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle.equals方法代码示例

本文整理汇总了Java中java.awt.Rectangle.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.equals方法的具体用法?Java Rectangle.equals怎么用?Java Rectangle.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Rectangle的用法示例。


在下文中一共展示了Rectangle.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Path2DCopyConstructor.java

示例2: disableEditOptScribbleObj

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * When selecting the scribble object (not one of its crops), the user
 * cannot edit its size by increasing/decreasing options, therefore they are
 * deactivated from the menu.
 *
 * @param selectedObj the object selected by the user
 */
private void disableEditOptScribbleObj(Objects selectedObj) {
    if (selectedObj == null) {
        return;
    }

    // get the box which was selected
    DisplayBBox selectedBox = gc.getdPImgToLabel().getSelectedBox();

    if (selectedBox != null) {
        // convert coordinates to panel coordinates to be able to compare
        Rectangle objBoxPanel = gc.getdPImgToLabel().getResize().originalToResized(selectedObj.getOuterBBox());

        // if the outer box of the obejct and the selection match, it means the scribble object is selected (not a crop)
        if (objBoxPanel.equals(selectedBox.getPanelBox())
                && (((ObjectScribble) selectedObj).getCrop(selectedBox.getPanelBox(), gc.getdPImgToLabel().getResize()) == null)) {
            // the selected object is the scribble obejct itself; disable some edit options
            enableEditButtons(false);
        }
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:28,代码来源:GUILabelingTool.java

示例3: setSelectionBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
public final void setSelectionBounds(Rectangle selectionBounds) {
    if (selectionBounds == null && this.selectionBounds == null) return;

    normalizeBounds(selectionBounds);

    if (this.selectionBounds != null && this.selectionBounds.equals(selectionBounds) ||
        selectionBounds != null && selectionBounds.equals(this.selectionBounds)) return;

    Rectangle oldSelectionBounds = this.selectionBounds == null ? null :
                                   new Rectangle(this.selectionBounds);

    if (selectionBounds == null) this.selectionBounds = null;
    else if (this.selectionBounds == null) this.selectionBounds = new Rectangle(selectionBounds);
    else this.selectionBounds.setBounds(selectionBounds);

    fireSelectionBoundsChanged(this.selectionBounds, oldSelectionBounds);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:TimelineSelectionManager.java

示例4: setMainWindowBoundsJoined

import java.awt.Rectangle; //导入方法依赖的package包/类
/** Sets main window bounds (joined[tiled] state) into model and requests view (if needed). */
public void setMainWindowBoundsJoined(Rectangle mainWindowBoundsJoined) {
    if(mainWindowBoundsJoined == null) {
        return;
    }
    
    Rectangle old = getMainWindowBoundsJoined();
    if(old.equals(mainWindowBoundsJoined)) {
        return;
    }
    
    model.setMainWindowBoundsJoined(mainWindowBoundsJoined);
    
    if(isVisible()) {
        viewRequestor.scheduleRequest(
            new ViewRequest(null, View.CHANGE_MAIN_WINDOW_BOUNDS_JOINED_CHANGED,
                old, mainWindowBoundsJoined));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Central.java

示例5: setMainWindowBoundsSeparated

import java.awt.Rectangle; //导入方法依赖的package包/类
/** Sets main window bounds (separated state) into model and requests view (if needed). */
public void setMainWindowBoundsSeparated(Rectangle mainWindowBoundsSeparated) {
    if(mainWindowBoundsSeparated == null) {
        return;
    }
    
    Rectangle old = getMainWindowBoundsSeparated();
    if(old.equals(mainWindowBoundsSeparated)) {
        return;
    }
    
    model.setMainWindowBoundsSeparated(mainWindowBoundsSeparated);
    
    if(isVisible()) {
        viewRequestor.scheduleRequest(
            new ViewRequest(null, View.CHANGE_MAIN_WINDOW_BOUNDS_SEPARATED_CHANGED,
                old, mainWindowBoundsSeparated));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Central.java

示例6: setEditorAreaBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/** Sets editor area bounds into model and requests view (if needed). */
public void setEditorAreaBounds(Rectangle editorAreaBounds) {
    if(editorAreaBounds == null) {
        return;
    }
    
    Rectangle old = getEditorAreaBounds();
    if(old.equals(editorAreaBounds)) {
        return;
    }
    
    model.setEditorAreaBounds(editorAreaBounds);
    
    if(isVisible()) {
        viewRequestor.scheduleRequest(
            new ViewRequest(null, View.CHANGE_EDITOR_AREA_BOUNDS_CHANGED,
                        old, editorAreaBounds));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Central.java

示例7: setModeBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/** Sets bounds into model and requests view (if needed). */
public void setModeBounds(ModeImpl mode, Rectangle bounds) {
    if(bounds == null) {
        return;
    }
    
    Rectangle old = getModeBounds(mode);
    if(old.equals(bounds)) {
        return;
    }
    
    model.setModeBounds(mode, bounds);
    
    if(isVisible() && getEditorAreaState() == Constants.EDITOR_AREA_SEPARATED) {
        viewRequestor.scheduleRequest(new ViewRequest(
            mode, View.CHANGE_MODE_BOUNDS_CHANGED, old, bounds));
    }
    
    mode.doFirePropertyChange(ModeImpl.PROP_BOUNDS, old, bounds);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Central.java

示例8: updateEditorHeight

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Makes sure the current editor height matches its content if the annotation was never resized.
 * If the annotation has been manually resized before, does nothing.
 *
 * @param anno
 *            the annotation currently in the editor
 */
private void updateEditorHeight(final WorkflowAnnotation anno) {
	if (anno.wasResized()) {
		return;
	}

	Rectangle bounds = editPane.getBounds();
	// height is either the pref height or the current height, depending on what is bigger
	int prefHeight;
	if (anno instanceof ProcessAnnotation) {
		prefHeight = (int) Math.max(getContentHeightOfEditor((int) bounds.getWidth()), bounds.getHeight());
	} else {
		prefHeight = Math.max(getContentHeightOfEditor((int) bounds.getWidth()), OperatorAnnotation.MIN_HEIGHT);
	}
	Rectangle newBounds = new Rectangle((int) bounds.getX(), (int) bounds.getY(), (int) bounds.getWidth(), prefHeight);
	if (!bounds.equals(newBounds)) {
		editPane.setBounds(newBounds);
		updateEditPanelPosition(newBounds, true);
		view.getModel().fireAnnotationMiscChanged(anno);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:AnnotationsDecorator.java

示例9: updateFinderBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * 
 */
public void updateFinderBounds(Rectangle bounds, boolean repaint)
{
	if (bounds != null && !bounds.equals(finderBounds))
	{
		Rectangle old = new Rectangle(finderBounds);
		finderBounds = bounds;

		// LATER: Fix repaint region to be smaller
		if (repaint)
		{
			old = old.union(finderBounds);
			old.grow(3, 3);
			repaint(old);
		}
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:20,代码来源:mxGraphOutline.java

示例10: setLandMask

import java.awt.Rectangle; //导入方法依赖的package包/类
public void setLandMask( Grid2D.Boolean landMask ) {
	Rectangle maskBounds = landMask.getBounds();
	Rectangle bounds = grid.getBounds();
	if( !maskBounds.equals(bounds) ) return;
	this.landMask = landMask;
	land = false;
	ocean = false;
	for( int y=bounds.y ; y<bounds.y+bounds.height ; y++) {
		for( int x=bounds.x ; x<bounds.x+bounds.width ; x++) {
			if( landMask.booleanValue(x,y) ) {
				land=true;
			} else {
				ocean=true;
			}
			if( land==ocean )return;
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:19,代码来源:GridImage.java

示例11: setPreviewBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * 
 */
public void setPreviewBounds(Rectangle bounds) {
  if ((bounds == null && previewBounds != null) || (bounds != null && previewBounds == null)
      || (bounds != null && previewBounds != null && !bounds.equals(previewBounds))) {
    Rectangle dirty = null;

    if (isVisible()) {
      dirty = previewBounds;

      if (dirty != null) {
        dirty.add(bounds);
      } else {
        dirty = bounds;
      }
    }

    previewBounds = bounds;

    if (dirty != null) {
      graphComponent.getGraphControl().repaint(dirty.x - 1, dirty.y - 1, dirty.width + 2,
          dirty.height + 2);
    }
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:27,代码来源:mxGraphHandler.java

示例12: selectComponent

import java.awt.Rectangle; //导入方法依赖的package包/类
private void selectComponent(ComponentInfo ci, boolean reActivated) {
    Node node = null;
    if (ci != null) {
        Rectangle oldSelection = null;
        if (selection != null) {
            oldSelection = selection;
        }
        selection = ci.getWindowBounds();
        if (oldSelection != null) {
            if (oldSelection.equals(selection) && !reActivated) {
                return ; // already selected
            }
            repaint((int) (scale * oldSelection.x), (int) (scale * oldSelection.y),
                    (int) (scale * oldSelection.width) + 3, (int) (scale * oldSelection.height) + 3);
        }
        repaint((int) (scale * selection.x), (int) (scale * selection.y),
                (int) (scale * selection.width) + 3, (int) (scale * selection.height) + 3);
        logger.fine("New selection = "+selection);
        node = componentNodes.findNodeFor(ci);
        logger.fine("FindNodeFor("+ci+") on '"+componentNodes+"' gives: "+node);
    }
    Node[] nodes;
    if (node != null) {
        nodes = new Node[] { node };
    } else {
        nodes = new Node[] {};
    }
    logger.fine("setActivated/SelectedNodes("+Arrays.toString(nodes)+")");
    setActivatedNodes(nodes);
    try {
        ComponentHierarchy.getInstance().getExplorerManager().setSelectedNodes(nodes);
    } catch (PropertyVetoException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:ScreenshotComponent.java

示例13: setDropLine

import java.awt.Rectangle; //导入方法依赖的package包/类
/** Set drop line. Given line is used by paint method.
 * @param line drop line */
public void setDropLine(Line2D line) {
    if( !isValid() )
        return;
    
    if( null != prevLineRect 
        && ((null != line
            && (!prevLineRect.contains( line.getP1() )
                || !prevLineRect.contains( line.getP2() )))
            || null == line) ) {
        
        repaint( prevLineRect );
    }

    this.line = line;
    Rectangle newLineRect = null;
    if( null != this.line ) {
        checkLineBounds( this.line );
        newLineRect = line.getBounds();
        newLineRect.grow( 5, 5 );
    }
    
    if( null != newLineRect && !newLineRect.equals( prevLineRect ) ) {
        repaint( newLineRect );
    }
    prevLineRect = newLineRect;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:DropGlassPane.java

示例14: setSelectionBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
public final void setSelectionBounds(Rectangle selectionBounds) {
    if (selectionBounds == null && this.selectionBounds == null) return;
    if (this.selectionBounds != null && this.selectionBounds.equals(selectionBounds) ||
        selectionBounds != null && selectionBounds.equals(this.selectionBounds)) return;

    Rectangle oldSelectionBounds = this.selectionBounds == null ? null :
                                   new Rectangle(this.selectionBounds);

    if (selectionBounds == null) this.selectionBounds = null;
    else if (this.selectionBounds == null) this.selectionBounds = new Rectangle(selectionBounds);
    else this.selectionBounds.setBounds(selectionBounds);

    fireSelectionBoundsChanged(this.selectionBounds, oldSelectionBounds);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ChartSelectionManager.java

示例15: setContentBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
void setContentBounds(WindowDimensions dims) {
    XToolkit.awtLock();
    try {
        // Bounds of content window are of the same size as bounds of Java window and with
        // location as -(insets)
        Rectangle newBounds = dims.getBounds();
        Insets in = dims.getInsets();
        if (in != null) {
            newBounds.setLocation(-in.left, -in.top);
        }
        if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
            insLog.fine("Setting content bounds {0}, old bounds {1}",
                        newBounds, getBounds());
        }
        // Fix for 5023533:
        // Change in the size of the content window means, well, change of the size
        // Change in the location of the content window means change in insets
        boolean needHandleResize = !(newBounds.equals(getBounds()));
        reshape(newBounds);
        if (needHandleResize) {
            insLog.fine("Sending RESIZED");
            handleResize(newBounds);
        }
    } finally {
        XToolkit.awtUnlock();
    }
    validateSurface();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:XContentWindow.java


注:本文中的java.awt.Rectangle.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。