|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
°³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå |
java.lang.Object | +--java.awt.geom.RectangularShape | +--java.awt.geom.Rectangle2D | +--java.awt.Rectangle
Rectangle
´Â Rectangle
¿ÀºêÁ§Æ®ÀÇ ÁÂÇ¥ °ø°£¿¡¼ÀÇ Á»óÀÇ Á¡ (x, y), ¹× ±× Æø°ú ³ôÀÌ¿¡ ÀÇÇØ µÑ·¯½ÎÀÌ´Â ÁÂÇ¥ °ø°£³»ÀÇ area¸¦ ÁöÁ¤ÇÕ´Ï´Ù.
Rectangle
¿ÀºêÁ§Æ®ÀÇ width
¹× height
´Â public
ÇʵåÀÔ´Ï´Ù. Rectangle
¸¦ ÀÛ¼ºÇÏ´Â constructor , ¹× Rectangle
¸¦ º¯°æÇÒ ¼ö ÀÖ´Â ¸Þ¼Òµå¿¡´Â width ³ª height ÀÇ °ªÀ¸·Î ÇØ¼ ºÎÀÇ °ªÀ» ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
Æø°ú ³ôÀ̰¡ ºÎÀÇ °ªÀÇ Rectangle
´Â ÇÏ´ÃÀÌ´Ù°í º¸¿©Áý´Ï´Ù. Rectangle
°¡ ºñ¾úÀ» °æ¿ì,isEmpty
¸Þ¼Òµå´Â true
¸¦ µ¹·ÁÁÝ´Ï´Ù. ÇÏ´ÃÀÇ Rectangle
¿¡´Â Á¡À» ÁöÁ¤ÇÒ ¼ö ¾ø½À´Ï´Ù. ´Ù¸¸,width
¹× height
ÀÇ °ªÀº À¯È¿ÇÕ´Ï´Ù. ÇÏ´ÃÀÇ Rectangle
´Â ÁÂÇ¥ °ø°£¿¡ ÀÖ¾î À§Ä¡¸¦ °¡Á®, ÇÏ´ÃÀÇ Rectangle
ÀÇ »çÀÌÁî ¶Ç´Â À§Ä¡¸¦ º¯°æÇÏ´Â ¸Þ¼Òµåµµ À¯È¿ÇÕ´Ï´Ù. º¹¼öÀÇ Rectangle
¿¡ ´ëÇÑ ¸Þ¼Òµå´Â ÀÌ·¯ÇÑ Rectangle
¿ÀºêÁ§Æ®¾È¿¡ width
¶Ç´Â height
ÀÇ °ªÀ¸·Î ÇØ¼ ºÎÀÇ °ªÀ» °¡Áö´Â Rectangle
¿ÀºêÁ§Æ®°¡ 1 °³À̱⵵ ÇÑ °æ¿ì, µ¿ÀÛÀÌ ÇÁ·ÎÅØ¼ÇµÇÁö ¾Ê½À´Ï´Ù. ÀÌ·¯ÇÑ ¸Þ¼Òµå¿¡´Â intersects
,intersection
, ¹× union
°¡ ÀÖ½À´Ï´Ù.
ÁßøµÈ Ŭ·¡½ºÀÇ °³¿ä |
Ŭ·¡½º java.awt.geom. Rectangle2D À» »ó¼Ó¹ÞÀº ÁßøµÈ Ŭ·¡½º |
Rectangle2D.Double , Rectangle2D.Float |
ÇʵåÀÇ °³¿ä | |
int |
height
Rectangle ÀÇ ³ôÀÌÀÔ´Ï´Ù. |
int |
width
Rectangle ÀÇ ÆøÀÔ´Ï´Ù. |
int |
x
Rectangle ÀÇ x ÁÂÇ¥ÀÔ´Ï´Ù. |
int |
y
Rectangle ÀÇ y ÁÂÇ¥ÀÔ´Ï´Ù. |
Ŭ·¡½º java.awt.geom. Rectangle2D ¿¡¼ »ó¼Ó¹ÞÀº Çʵå |
OUT_BOTTOM , OUT_LEFT , OUT_RIGHT , OUT_TOP |
»ý¼ºÀÚÀÇ °³¿ä | |
Rectangle ()
Á»󱸼®ÀÌ ÁÂÇ¥ °ø°£ÀÇ (0, 0)¿¡ ÀÖ¾î, Æø°ú ³ôÀ̰¡ ¾çÂÊ ¸ðµÎ 0 ÀÇ »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
Rectangle (Dimension d)
Á»󱸼®ÀÌ (0, 0)·Î, Æø°ú ³ôÀ̰¡ Dimension Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
Rectangle (int width,
int height)
Á»󱸼®ÀÌ ÁÂÇ¥ °ø°£ÀÇ (0, 0)¿¡ ÀÖ¾î, Æø°ú ³ôÀ̰¡ width Àμö ¹× height Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
Rectangle (int x,
int y,
int width,
int height)
Á»󱸼®ÀÌ ( x , y )·Î¼ ÁöÁ¤µÇ¾î Æø°ú ³ôÀ̰¡ width Àμö ¹× height Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
Rectangle (Point p)
Á»󱸼®ÀÌ ÁöÁ¤µÈ Point ·Î, Æø°ú ³ôÀ̰¡ ¾çÂÊ ¸ðµÎ 0 ÀÎ »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
Rectangle (Point p,
Dimension d)
Á»󱸼®ÀÌ Point Àμö·Î ÁöÁ¤µÇ¾î Æø°ú »çÀÌÁî°¡ Dimension Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
Rectangle (Rectangle r)
ÁöÁ¤µÈ Rectangle ÀÇ °ª¿¡ ÀÏÄ¡Çϵµ·Ï(µíÀÌ) ÃʱâÈµÈ »õ·Î¿î Rectangle ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
¸Þ¼ÒµåÀÇ °³¿ä | |
void |
add (int newx,
int newy)
Á¤¼öÇüÀÇ Àμö newx ¹× newy ¿¡ ÀÇÇØ ÁöÁ¤µÇ´Â Á¡À» ÀÌ Rectangle ¿¡ Ãß°¡ÇÕ´Ï´Ù. |
void |
add (Point pt)
ÀÌ Rectangle ¿¡, ÁöÁ¤µÈ Point ¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
add (Rectangle r)
Rectangle ¸¦ ÀÌ Rectangle ¿¡ Ãß°¡ÇÕ´Ï´Ù. |
boolean |
contains (int x,
int y)
ÀÌ Rectangle °¡, ÁöÁ¤µÈ À§Ä¡ (x, y)¿¡ ÀÖ´Â Á¡À» Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
boolean |
contains (int X,
int Y,
int W,
int H)
ÁöÁ¤µÈ À§Ä¡ (X, Y)¿¡ ÀÖ¾î, ÁöÁ¤µÈ »çÀÌÁî (W, H)ÀÎ Rectangle ¸¦, ÀÌ Rectangle °¡ ¿ÏÀüÇÏ°Ô Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
boolean |
contains (Point p)
ÀÌ Rectangle °¡ ÁöÁ¤µÈ Point ¸¦ Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
boolean |
contains (Rectangle r)
ÀÌ Rectangle °¡, ÁöÁ¤µÈ Rectangle ¸¦ ¿ÏÀüÇÏ°Ô Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
Rectangle2D |
createIntersection (Rectangle2D r)
ÀÌ Rectangle ¿Í ÁöÁ¤µÈ Rectangle2D ¿ÍÀÇ °øÅë ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle2D ¿ÀºêÁ§Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. |
Rectangle2D |
createUnion (Rectangle2D r)
ÀÌ Rectangle ¿Í ÁöÁ¤µÈ Rectangle2D ¿ÍÀÇ °áÇÕ ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle2D ¿ÀºêÁ§Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. |
boolean |
equals (Object obj)
2 °³ÀÇ ±¸ÇüÀÌ °°Àº°¡ ¾î¶²°¡¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
Rectangle |
getBounds ()
ÀÌ Rectangle ÀÇ °æ°èÀÇ Rectangle area¸¦ µ¹·ÁÁÝ´Ï´Ù.
|
Rectangle2D |
getBounds2D ()
ÀÌ ±¸ÇüÀÇ °íÁ¤¹Ðµµ ¹Ù¿îµò±×º¹½º¸¦ µ¹·ÁÁÝ´Ï´Ù. |
double |
getHeight ()
°æ°èÀÇ Rectangle areaÀÇ ³ôÀ̸¦ double Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù. |
Point |
getLocation ()
ÀÌ Rectangle ÀÇ À§Ä¡¸¦ µ¹·ÁÁÝ´Ï´Ù.
|
Dimension |
getSize ()
µ¹·ÁÁÖ¾îÁø Dimension ·Î ³ªÅ¸³»Áø, ÀÌ Rectangle ÀÇ »çÀÌÁ µ¹·ÁÁÝ´Ï´Ù.
|
double |
getWidth ()
°æ°èÀÇ Rectangle areaÀÇ ÆøÀ» double Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù. |
double |
getX ()
°æ°èÀÇ Rectangle areaÀÇ X ÁÂÇ¥¸¦ double Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù. |
double |
getY ()
°æ°èÀÇ Rectangle areaÀÇ Y ÁÂÇ¥¸¦ double Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù. |
void |
grow (int h,
int v)
Rectangle ¸¦ ¼öÆò ¹æÇâ°ú ¼öÁ÷ ¹æÇâÀÇ ¾çÂÊ ¸ðµÎ·Î »çÀÌÁî º¯°æÇÕ´Ï´Ù.
|
boolean |
inside (int X,
int Y)
Ãßõ µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. JDK ¹öÁ¯ 1.1 ÀÌÈÄ´Â contains(int, int) ¸¦ »ç¿ë |
Rectangle |
intersection (Rectangle r)
ÀÌ Rectangle ¿Í ÁöÁ¤µÈ Rectangle ¿ÍÀÇ °øÅë ºÎºÐÀ» »êÃâÇÕ´Ï´Ù. |
boolean |
intersects (Rectangle r)
ÀÌ Rectangle ¿Í ÁöÁ¤µÈ Rectangle °¡ ±³Â÷ÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
boolean |
isEmpty ()
ÀÌ Rectangle °¡ ÇÏ´ÃÀÏÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
void |
move (int x,
int y)
Ãßõ µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. JDK ¹öÁ¯ 1.1 ÀÌÈÄ´Â setLocation(int, int) ¸¦ »ç¿ë |
int |
outcode (double x,
double y)
ÁöÁ¤µÈ ÁÂÇ¥°¡ ÀÌ Rectangle ¿¡ ´ëÇÑ »ó´ë À§Ä¡¿¡¼ ¾îµð¿¡ À§Ä¡ÇÏ´ÂÁö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
void |
reshape (int x,
int y,
int width,
int height)
Ãßõ µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. JDK ¹öÁ¯ 1.1 ÀÌÈÄ´Â setBounds(int, int, int, int) ¸¦ »ç¿ë |
void |
resize (int width,
int height)
Ãßõ µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. JDK ¹öÁ¯ 1.1 ÀÌÈÄ´Â setSize(int, int) ¸¦ »ç¿ë |
void |
setBounds (int x,
int y,
int width,
int height)
ÀÌ Rectangle ÀÇ °æ°èÀÇ Rectangle area¸¦,x ,y ,width , ¹× height ·Î ÁöÁ¤µÈ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù.
|
void |
setBounds (Rectangle r)
ÀÌ Rectangle ÀÇ °æ°èÀÇ Rectangle area¸¦, ÁöÁ¤µÈ Rectangle ¿¡ ÀÏÄ¡Çϵµ·Ï(µíÀÌ) ¼³Á¤ÇÕ´Ï´Ù.
|
void |
setLocation (int x,
int y)
ÀÌ Rectangle °¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
|
void |
setLocation (Point p)
ÀÌ Rectangle °¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
|
void |
setRect (double x,
double y,
double width,
double height)
ÀÌ Rectangle ÀÇ °æ°è°¡ ÁöÁ¤µÈ x ,y ,width , ¹× height ·Î ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSize (Dimension d)
ÀÌ Rectangle ÀÇ »çÀÌÁ, ÁöÁ¤µÈ Dimension ¿¡ ÀÏÄ¡Çϵµ·Ï(µíÀÌ) ¼³Á¤ÇÕ´Ï´Ù.
|
void |
setSize (int width,
int height)
ÀÌ Rectangle ÀÇ Å©±â°¡ ÁöÁ¤µÈ Æø°ú ³ôÀÌ·Î ¼³Á¤ÇÕ´Ï´Ù.
|
String |
toString ()
ÀÌ Rectangle ¹× ±× °ªÀ» ³ªÅ¸³»´Â String Ç¥ÇöÀ» µ¹·ÁÁÝ´Ï´Ù. |
void |
translate (int x,
int y)
x ÁÂÇ¥Ãà¿¡ µû¶ó ¿ìÃøÇâ¿¡, y ÁÂÇ¥Ãà¿¡ µû¶ó ¾Æ·¡¹æÇâ¿¡, ÁöÁ¤µÈ °Å¸®¸¸ ÀÌ Rectangle ¸¦ À̵¿ÇÕ´Ï´Ù. |
Rectangle |
union (Rectangle r)
ÀÌ Rectangle ¿Í ÁöÁ¤µÈ Rectangle ¿ÍÀÇ °áÇÕ ºÎºÐÀ» »êÃâÇÕ´Ï´Ù. |
Ŭ·¡½º java.awt.geom. Rectangle2D ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
add , add , add , contains , contains , getPathIterator , getPathIterator , hashCode , intersect , intersects , intersectsLine , intersectsLine , outcode , setFrame , setRect , union |
Ŭ·¡½º java.awt.geom. RectangularShape ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
clone , contains , contains , getCenterX , getCenterY , getFrame , getMaxX , getMaxY , getMinX , getMinY , intersects , setFrame , setFrame , setFrameFromCenter , setFrameFromCenter , setFrameFromDiagonal , setFrameFromDiagonal |
Ŭ·¡½º java.lang. Object ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
finalize , getClass , notify , notifyAll , wait , wait , wait |
ÀÎÅÍÆäÀ̽º java.awt. Shape ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
contains , contains , contains , contains , getPathIterator , getPathIterator , intersects , intersects |
ÇʵåÀÇ »ó¼¼ |
public int x
Rectangle
ÀÇ x ÁÂÇ¥ÀÔ´Ï´Ù.
setLocation(int, int)
,
getLocation()
public int y
Rectangle
ÀÇ y ÁÂÇ¥ÀÔ´Ï´Ù.
setLocation(int, int)
,
getLocation()
public int width
Rectangle
ÀÇ ÆøÀÔ´Ï´Ù.
setSize(int, int)
,
getSize()
public int height
Rectangle
ÀÇ ³ôÀÌÀÔ´Ï´Ù.
setSize(int, int)
,
getSize()
»ý¼ºÀÚÀÇ »ó¼¼ |
public Rectangle()
Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
public Rectangle(Rectangle r)
Rectangle
ÀÇ °ª¿¡ ÀÏÄ¡Çϵµ·Ï(µíÀÌ) ÃʱâÈµÈ »õ·Î¿î Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
r
- »õ·Ó°Ô ±¸ÃàµÇ´Â Rectangle
ÀÇ ÃʱâÄ¡ÀÇ Ä«ÇÇ¿øÀÌ µÇ´Â Rectangle
public Rectangle(int x, int y, int width, int height)
x
, y
)·Î¼ ÁöÁ¤µÇ¾î Æø°ú ³ôÀ̰¡ width Àμö ¹× height Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
width
- Rectangle
ÀÇ Æøheight
- Rectangle
ÀÇ ³ôÀÌpublic Rectangle(int width, int height)
Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
width
- Rectangle
ÀÇ Æøheight
- Rectangle
ÀÇ ³ôÀÌpublic Rectangle(Point p, Dimension d)
Point
Àμö·Î ÁöÁ¤µÇ¾î Æø°ú »çÀÌÁî°¡ Dimension
Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
p
- Rectangle
ÀÇ Á»󱸼®ÀÌ µÇ´Â Point
d
- Rectangle
ÀÇ Æø°ú ³ôÀ̸¦ ³ªÅ¸³»´Â Dimension
public Rectangle(Point p)
Point
·Î, Æø°ú ³ôÀ̰¡ ¾çÂÊ ¸ðµÎ 0 ÀÎ »õ·Î¿î Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
p
- Rectangle
ÀÇ Á»󱸼®ÀÌ µÇ´Â Point
public Rectangle(Dimension d)
Dimension
Àμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle
¸¦ ±¸ÃàÇÕ´Ï´Ù.
d
- Æø°ú ³ôÀ̸¦ ÁöÁ¤ÇÏ´Â Dimension
¸Þ¼ÒµåÀÇ »ó¼¼ |
public double getX()
Rectangle
areaÀÇ X ÁÂÇ¥¸¦ double
Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù.
RectangularShape
³»ÀÇ getX
Rectangle
areaÀÇ x ÁÂÇ¥public double getY()
Rectangle
areaÀÇ Y ÁÂÇ¥¸¦ double
Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù.
RectangularShape
³»ÀÇ getY
Rectangle
areaÀÇ y ÁÂÇ¥public double getWidth()
Rectangle
areaÀÇ ÆøÀ» double
Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù.
RectangularShape
³»ÀÇ getWidth
Rectangle
areaÀÇ Æøpublic double getHeight()
Rectangle
areaÀÇ ³ôÀ̸¦ double
Á¤¹Ðµµ·Î µ¹·ÁÁÝ´Ï´Ù.
RectangularShape
³»ÀÇ getHeight
Rectangle
areaÀÇ ³ôÀÌpublic Rectangle getBounds()
Rectangle
ÀÇ °æ°èÀÇ Rectangle
area¸¦ µ¹·ÁÁÝ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ getBounds
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
Shape
³»ÀÇ getBounds
RectangularShape
³»ÀÇ getBounds
Rectangle. ÀÌ Rectangle
ÀÇ °æ°èÀÇ Rectangle area¿¡ µ¿ÀÏÇÑ- µµÀÔµÈ ¹öÁ¯:
- JDK1. 1
- °ü·Ã Ç׸ñ:
Component.getBounds()
,
setBounds(Rectangle)
,
setBounds(int, int, int, int)
public Rectangle2D getBounds2D()
Shape
³»ÀÇ getBounds2D
Rectangle2D
³»ÀÇ getBounds2D
Shape
ÀÇ °íÁ¤¹Ðµµ ¹Ù¿îµò±×º¹½º¸¦ ³ªÅ¸³»´Â Rectangle2D
ÀÇ ÀνºÅϽºShape.getBounds()
public void setBounds(Rectangle r)
Rectangle
ÀÇ °æ°èÀÇ Rectangle
area¸¦, ÁöÁ¤µÈ Rectangle
¿¡ ÀÏÄ¡Çϵµ·Ï(µíÀÌ) ¼³Á¤ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setBounds
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
r
- ÁöÁ¤µÈ Rectangle
getBounds()
,
Component.setBounds(java.awt.Rectangle)
public void setBounds(int x, int y, int width, int height)
Rectangle
ÀÇ °æ°èÀÇ Rectangle
area¸¦,x
,y
,width
, ¹× height
·Î ÁöÁ¤µÈ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setBounds
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
width
- ÀÌ Rectangle
ÀÇ »õ·Î¿î Æøheight
- ÀÌ Rectangle
ÀÇ »õ·Î¿î ³ôÀÌgetBounds()
,
Component.setBounds(int, int, int, int)
public void setRect(double x, double y, double width, double height)
Rectangle
ÀÇ °æ°è°¡ ÁöÁ¤µÈ x
,y
,width
, ¹× height
·Î ¼³Á¤ÇÕ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setBounds
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
Rectangle2D
³»ÀÇ setRect
width
- Dimension
¿ÀºêÁ§Æ®ÀÇ »õ·Î¿î Æøheight
- Dimension
¿ÀºêÁ§Æ®ÀÇ »õ·Î¿î ³ôÀÌpublic void reshape(int x, int y, int width, int height)
setBounds(int, int, int, int)
¸¦ »ç¿ë
Rectangle
ÀÇ °æ°èÀÇ Rectangle
area¸¦,x
,y
,width
, ¹× height
·Î ÁöÁ¤µÈ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù.
width
- ÀÌ Rectangle
ÀÇ »õ·Î¿î Æøheight
- ÀÌ Rectangle
ÀÇ »õ·Î¿î ³ôÀÌpublic Point getLocation()
Rectangle
ÀÇ À§Ä¡¸¦ µ¹·ÁÁÝ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ getLocation
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
Rectangle
ÀÇ Á»󱸼®ÀÇ Point
Component.getLocation()
,
setLocation(Point)
,
setLocation(int, int)
public void setLocation(Point p)
Rectangle
°¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setLocation
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
p
- ÀÌ Rectangle
ÀÇ »õ·Î¿î À§Ä¡¸¦ ÁöÁ¤ÇÏ´Â Point
Component.setLocation(java.awt.Point)
,
getLocation()
public void setLocation(int x, int y)
Rectangle
°¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setLocation
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
getLocation()
,
Component.setLocation(int, int)
public void move(int x, int y)
setLocation(int, int)
¸¦ »ç¿ë
Rectangle
°¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
public void translate(int x, int y)
Rectangle
¸¦ À̵¿ÇÕ´Ï´Ù.
x
- x ÃàÀ¸·Î µû¶ó ÀÌ Rectangle
¸¦ À̵¿ÇÏ´Â °Å¸®y
- y ÃàÀ¸·Î µû¶ó ÀÌ Rectangle
¸¦ À̵¿ÇÏ´Â °Å¸®setLocation(int, int)
,
setLocation(java.awt.Point)
public Dimension getSize()
Dimension
·Î ³ªÅ¸³»Áø, ÀÌ Rectangle
ÀÇ »çÀÌÁ µ¹·ÁÁÝ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ getSize
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
Rectangle
ÀÇ »çÀÌÁ ³ªÅ¸³»´Â Dimension
Component.getSize()
,
setSize(Dimension)
,
setSize(int, int)
public void setSize(Dimension d)
Rectangle
ÀÇ »çÀÌÁ, ÁöÁ¤µÈ Dimension
¿¡ ÀÏÄ¡Çϵµ·Ï(µíÀÌ) ¼³Á¤ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setSize
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
d
- Dimension
¿ÀºêÁ§Æ®ÀÇ »õ·Î¿î »çÀÌÁîComponent.setSize(java.awt.Dimension)
,
getSize()
public void setSize(int width, int height)
Rectangle
ÀÇ Å©±â°¡ ÁöÁ¤µÈ Æø°ú ³ôÀÌ·Î ¼³Á¤ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â ¿ÏÀü¼ºÀ» À§Çؼ(¶§¹®¿¡) ÁغñµÇ¾î ÀÖ¾î¼ ,Component
ÀÇ setSize
¸Þ¼Òµå¿¡ ´ëÀÀÇÕ´Ï´Ù.
width
- ÀÌ Rectangle
ÀÇ »õ·Î¿î Æøheight
- ÀÌ Rectangle
ÀÇ »õ·Î¿î ³ôÀÌComponent.setSize(int, int)
,
getSize()
public void resize(int width, int height)
setSize(int, int)
¸¦ »ç¿ë
Rectangle
ÀÇ Å©±â°¡ ÁöÁ¤µÈ Æø°ú ³ôÀÌ·Î ¼³Á¤ÇÕ´Ï´Ù.
width
- ÀÌ Rectangle
ÀÇ »õ·Î¿î Æøheight
- ÀÌ Rectangle
ÀÇ »õ·Î¿î ³ôÀÌpublic boolean contains(Point p)
Rectangle
°¡ ÁöÁ¤µÈ Point
¸¦ Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
p
- ÆÇÁ¤ÇÏ´Â ´ë»óÀÌ µÇ´Â Point
Point
(x, y)°¡ ÀÌ Rectangle
ÀÇ ³»ºÎ¿¡ ÀÖ´Â °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public boolean contains(int x, int y)
Rectangle
°¡, ÁöÁ¤µÈ À§Ä¡ (x, y)¿¡ ÀÖ´Â Á¡À» Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
Rectangle
ÀÇ ³»ºÎ¿¡ ÀÖ´Â °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public boolean contains(Rectangle r)
Rectangle
°¡, ÁöÁ¤µÈ Rectangle
¸¦ ¿ÏÀüÇÏ°Ô Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
r
- ÁöÁ¤µÈ Rectangle
Rectangle
°¡ ÀÌ Rectangle
¿¡ ¿ÏÀüÇÏ°Ô Æ÷ÇԵǴ °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public boolean contains(int X, int Y, int W, int H)
Rectangle
¸¦, ÀÌ Rectangle
°¡ ¿ÏÀüÇÏ°Ô Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
W
- Rectangle
ÀÇ ÆøH
- Rectangle
ÀÇ ³ôÀÌ
Rectangle
°¡ ¿ÏÀüÇÏ°Ô ÀÌ Rectangle
³»¿¡ µé¾î°¡´Â °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public boolean inside(int X, int Y)
contains(int, int)
¸¦ »ç¿ë
Rectangle
°¡, ÁöÁ¤µÈ À§Ä¡ (X, Y)¿¡ ÀÖ´Â Á¡À» Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
Rectangle
ÀÇ ³»ºÎ¿¡ ÀÖ´Â °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public boolean intersects(Rectangle r)
Rectangle
¿Í ÁöÁ¤µÈ Rectangle
°¡ ±³Â÷ÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. °øÅë ºÎºÐÀÌ ÇÏ´ÃÀÌ ¾Æ´Ñ °æ¿ì, 2 °³ÀÇ ±¸ÇüÀº ±³Â÷ÇÕ´Ï´Ù.
r
- ÁöÁ¤µÈ Rectangle
Rectangle
°÷ÀÇ Rectangle
°¡ ¼·Î °ãÄ¡´Â °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public Rectangle intersection(Rectangle r)
Rectangle
¿Í ÁöÁ¤µÈ Rectangle
¿ÍÀÇ °øÅë ºÎºÐÀ» »êÃâÇÕ´Ï´Ù. 2 °³ÀÇ ±¸ÇüÀÇ °øÅë ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle
¸¦ µ¹·ÁÁÝ´Ï´Ù. 2 °³ÀÇ ±¸ÇüÀÌ ±³Â÷ÇÏÁö ¾Ê´Â °æ¿ì, ÇÏ´ÃÀÇ ±¸ÇüÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù.
r
- ÁöÁ¤µÈ Rectangle
Rectangle
°÷ÀÇ Rectangle
ÀÇ ¾çÂÊ ¸ðµÎ¿¡ Æ÷ÇԵǴ ÃÖ´ëÀÇ Rectangle
, ¶Ç´Â ±¸ÇüÀÌ ±³Â÷ÇÏÁö ¾Ê´Â °æ¿ì´Â ÇÏ´ÃÀÇ ±¸Çüpublic Rectangle union(Rectangle r)
Rectangle
¿Í ÁöÁ¤µÈ Rectangle
¿ÍÀÇ °áÇÕ ºÎºÐÀ» »êÃâÇÕ´Ï´Ù. 2 °³ÀÇ ±¸ÇüÀÇ °áÇÕ ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle
¸¦ µ¹·ÁÁÝ´Ï´Ù.
r
- ÁöÁ¤µÈ Rectangle
Rectangle
°÷ÀÇ Rectangle
ÀÇ ¾çÂÊ ¸ðµÎ¿¡ Æ÷ÇԵǴ ÃÖ¼ÒÀÇ Rectangle
public void add(int newx, int newy)
newx
¹× newy
¿¡ ÀÇÇØ ÁöÁ¤µÇ´Â Á¡À» ÀÌ Rectangle
¿¡ Ãß°¡ÇÕ´Ï´Ù. ÀÌ °á°ú, ¿øÀÇ Rectangle
¿Í ÁöÁ¤µÈ Á¡ÀÇ ¾çÂÊ ¸ðµÎ¸¦ Æ÷ÇÔÇÑ ÃÖ¼ÒÀÇ Rectangle
°¡ ÀÛ¼ºµË´Ï´Ù.
Á¡À» Ãß°¡ÇÑ ÈÄ¿¡, Ãß°¡µÈ Á¡À» Àμö·Î¼ ÁöÁ¤ÇØ contains
¸¦ È£ÃâÇßÀ» °æ¿ì, ¹Ýµå½Ã true
°¡ µ¹·ÁÁÖ¾îÁø´Ù°í´Â ÇÒ ¼ö ¾ø½À´Ï´Ù. contains
¸Þ¼Òµå´Â Rectangle
ÀÇ ¿ì´Ü ¶Ç´Â ÇÏ´Ü¿¡ À§Ä¡ÇÏ´Â Á¡ÀÇ °æ¿ì´Â true
¸¦ µ¹·ÁÁÖÁö ¾Ê½À´Ï´Ù. ±× ¶§¹®¿¡, Ãß°¡µÈ Á¡ÀÌ È®´ë ÈÄÀÇ Rectangle
ÀÇ ¿ì´Ü ¶Ç´Â ÇÏ´Ü¿¡ À§Ä¡ÇÏ´Â Á¡ÀÎ °æ¿ì¿¡´Â contains
´Â false
¸¦ µ¹·ÁÁÝ´Ï´Ù.
public void add(Point pt)
Rectangle
¿¡, ÁöÁ¤µÈ Point
¸¦ Ãß°¡ÇÕ´Ï´Ù. ÀÌ °á°ú, ¿øÀÇ Rectangle
¿Í ÁöÁ¤µÈ Point
ÀÇ ¾çÂÊ ¸ðµÎ¸¦ Æ÷ÇÔÇÑ ÃÖ¼ÒÀÇ Rectangle
°¡ ÀÛ¼ºµË´Ï´Ù.
Point
¸¦ Ãß°¡ÇÑ ÈÄ¿¡, Ãß°¡µÈ Point
¸¦ Àμö·Î¼ ÁöÁ¤ÇØ contains
¸¦ È£ÃâÇßÀ» °æ¿ì, ¹Ýµå½Ã true
°¡ µ¹·ÁÁÖ¾îÁø´Ù°í´Â ÇÒ ¼ö ¾ø½À´Ï´Ù. contains
¸Þ¼Òµå´Â Rectangle
ÀÇ ¿ì´Ü ¶Ç´Â ÇÏ´Ü¿¡ À§Ä¡ÇÏ´Â Á¡ÀÇ °æ¿ì´Â true
¸¦ µ¹·ÁÁÖÁö ¾Ê½À´Ï´Ù. ±× ¶§¹®¿¡, Ãß°¡µÈ Point
°¡ È®´ë ÈÄÀÇ Rectangle
ÀÇ ¿ì´Ü ¶Ç´Â ÇÏ´Ü¿¡ À§Ä¡ÇÏ´Â Á¡ÀÎ °æ¿ì¿¡´Â contains
´Â Point
¿¡ ´ëÇØ¼ false
¸¦ µ¹·ÁÁÝ´Ï´Ù.
pt
- ÀÌ Rectangle
¿¡ Ãß°¡µÇ´Â »õ·Î¿î Point
public void add(Rectangle r)
Rectangle
¸¦ ÀÌ Rectangle
¿¡ Ãß°¡ÇÕ´Ï´Ù. ÀÌ °á°ú, 2 °³ÀÇ ±¸ÇüÀÇ °áÇÕ ºÎºÐÀÌ µÇ´Â Rectangle
°¡ ÀÛ¼ºµË´Ï´Ù.
r
- ÁöÁ¤µÈ Rectangle
public void grow(int h, int v)
Rectangle
¸¦ ¼öÆò ¹æÇâ°ú ¼öÁ÷ ¹æÇâÀÇ ¾çÂÊ ¸ðµÎ·Î »çÀÌÁî º¯°æÇÕ´Ï´Ù.
ÀÌ ¸Þ¼Òµå´Â Á¿쿡 °¢°¢ h
´ÜÀ§¾¿, »óÇÏ¿¡ °¢°¢ v
´ÜÀ§¾¿ Ä¿Áöµµ·Ï(µíÀÌ),Rectangle
¸¦ º¯°æÇÕ´Ï´Ù.
»õ·Î¿î Rectangle
ÀÇ Á»󱸼®Àº (x - h
, y - v
), ÆøÀº width
+
2h
, ³ôÀÌ´Â height
+
2v
°¡ µË´Ï´Ù.
h
¿Í v
¿¡ ºÎÀÇ °ªÀÌ ÁöÁ¤µÇ¾úÀ» °æ¿ì,Rectangle
ÀÇ »çÀÌÁî´Â ÀÛ¾ÆÁý´Ï´Ù. grow
¸Þ¼Òµå´Â °á°úÀÇ width
¹× height
ÀÇ °ªÀÌ ºÎ°¡ ¾Æ´ÑÁö ¾î¶²Áö¸¦ °Ë»çÇÏÁö ¾Ê½À´Ï´Ù.
h
- ¼öÆò ¹æÇâÀ¸·Î È®´ëÇÏ´Â ¾çv
- ¼öÁ÷ ¹æÇâÀ¸·Î È®´ëÇÏ´Â ¾çpublic boolean isEmpty()
Rectangle
°¡ ÇÏ´ÃÀÏÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. Æø°ú »çÀÌÁî°¡ 0 ÀÌÇÏÀÇ °æ¿ì,Rectangle
´Â ºñ¿ó´Ï´Ù.
RectangularShape
³»ÀÇ isEmpty
Rectangle
°¡ ÇÏ´ÃÀÎ °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public int outcode(double x, double y)
Rectangle
¿¡ ´ëÇÑ »ó´ë À§Ä¡¿¡¼ ¾îµð¿¡ À§Ä¡ÇÏ´ÂÁö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â ÀÌ Rectangle
ÀÇ °¢º¯¿¡ ´ëÇØ, ÁöÁ¤µÈ Á¡ÀÌ ÀÌ Rectangle
¿ÜÀÇ ¿·°ú °°Àº Ãø¿¡ ÀÖ´ÂÁö¸¦ ³ªÅ¸³»´Â ÇØ´çÇÏ´Â ¸¶½ºÅ©Ä¡ÀÇ ¹ÙÀ̳ʸ®ÀÇ ³í¸®ÇÕÀ» °è»êÇÕ´Ï´Ù.
Rectangle2D
³»ÀÇ outcode
Rectangle2D.OUT_LEFT
,
Rectangle2D.OUT_TOP
,
Rectangle2D.OUT_RIGHT
,
Rectangle2D.OUT_BOTTOM
public Rectangle2D createIntersection(Rectangle2D r)
Rectangle
¿Í ÁöÁ¤µÈ Rectangle2D
¿ÍÀÇ °øÅë ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle2D
¿ÀºêÁ§Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù.
Rectangle2D
³»ÀÇ createIntersection
r
- ÀÌ Rectangle
¿Í ¼·Î °ãÄ¡´Â Rectangle2D
Rectangle2D
°÷ÀÇ Rectangle
ÀÇ ¾çÂÊ ¸ðµÎ¿¡ Æ÷ÇԵǴ ÃÖ´ëÀÇ Rectangle2D
public Rectangle2D createUnion(Rectangle2D r)
Rectangle
¿Í ÁöÁ¤µÈ Rectangle2D
¿ÍÀÇ °áÇÕ ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle2D
¿ÀºêÁ§Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù.
Rectangle2D
³»ÀÇ createUnion
r
- ÀÌ Rectangle
¿Í °áÇյǴ Rectangle2D
Rectangle2D
°÷ÀÇ Rectangle
ÀÇ ¾çÂÊ ¸ðµÎ¸¦ Æ÷ÇÔÇÑ ÃÖ¼ÒÀÇ Rectangle2D
public boolean equals(Object obj)
Àμö°¡ null
°¡ ¾Æ´Ï°í, ÀÌ Rectangle
¿Í °°Àº Á»󱸼®, ³ôÀÌ, ¹× ÆøÀ» °¡Áö´Â Rectangle
¿ÀºêÁ§Æ®ÀÎ °æ¿ì¿¡¸¸, °á°ú´Â true
°¡ µË´Ï´Ù.
Rectangle2D
³»ÀÇ equals
obj
- ÀÌ Rectangle
¿Í ºñ±³ÇÏ´Â Object
true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
public String toString()
Rectangle
¹× ±× °ªÀ» ³ªÅ¸³»´Â String
Ç¥ÇöÀ» µ¹·ÁÁÝ´Ï´Ù.
Object
³»ÀÇ toString
Rectangle
¿ÀºêÁ§Æ®ÀÇ ÁÂÇ¥¿Í »çÀÌÁîÀÇ °ªÀ» ³ªÅ¸³»´Â String
|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
°³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå |
Java, Java 2 D, ¹× JDBC ´Â ¹Ì±¹ ¹× ±× ¿ÜÀÇ ³ª¶ó¿¡ ÀÖ¾î¼ÀÇ ¹Ì±¹ Sun Microsystems, Inc. ÀÇ »óÇ¥ ȤÀº µî·Ï»óÇ¥ÀÔ´Ï´Ù.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.