本文整理匯總了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.");
}
示例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);
}
}
}
示例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);
}
示例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));
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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();
}