Java Shape.intersects(Rectangle2D r)

Syntax

Shape.intersects(Rectangle2D r) has the following syntax.

boolean intersects(Rectangle2D r)

Example

In the following code shows how to use Shape.intersects(Rectangle2D r) method.


//from w ww  .  j  av  a  2 s.c  o m
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;

public class Main {
  public static void main(String[] args) throws Exception {
    Shape s = new Rectangle2D.Double(0, 0, 72, 72);
    
    System.out.println(s.intersects(new Rectangle(10,10,20,20)));
  }

}




















Home »
  Java Tutorial »
    java.awt »




BasicStroke
BorderLayout
CardLayout
Color
Cursor
Desktop
DesktopManager
DisplayMode
EventQueue
FlowLayout
FocusTraversalPolicy
Font
FontMetrics
GradientPaint
Graphics
Graphics2D
GraphicsConfiguration
GraphicsDevice
GraphicsEnvironment
GridBagConstraints
GridBagLayout
GridLayout
Image
ItemSelectable
KeyboardFocusManager
LayoutManager
LayoutManager2
Point
Rectangle
Robot
Shape
SplashScreen
SystemColor
SystemTray
TexturePaint
TrayIcon
Toolkit
Transparency