|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
| °³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå | |||||||||
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
public class Rectangle
Rectangle´Â
Rectangle °´Ã¼ÀÇ ÁÂÇ¥ °ø°£¿¡¼ÀÇ Á»óÀÇ Á¡ (x, y) ¹× ±× Æø°ú ³ôÀÌ¿¡ ÀÇÇØ µÑ·¯½ÎÀÌ´Â ÁÂÇ¥ °ø°£³»ÀÇ ¿µ¿ªÀ» ÁöÁ¤ÇÕ´Ï´Ù.
Rectangle °´Ã¼ÀÇ width ¹× height´Â public ÇʵåÀÔ´Ï´Ù. Rectangle¸¦ ÀÛ¼ºÇÏ´Â »ý¼ºÀÚ
¹× Rectangle¸¦ º¯°æÇÒ ¼ö ÀÖ´Â ¸Þ¼µå¿¡´Â width ³ª height
°ªÀ¸·Î ÇØ¼ À߸øµÈ °ªÀ» ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
Æø°ú ³ôÀ̰¡ À߸øµÈ °ªÀÇ Rectangle´Â ºñ¾îÀÖ´Ù°í º¸¿©Áý´Ï´Ù. Rectangle°¡ ºñ¾îÀÖ´Â °æ¿ì, isEmpty ¸Þ¼µå´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. ºñ¾îÀÖ´Â Rectangle¿¡´Â Á¡À» ÁöÁ¤ÇÒ ¼ö ¾ø½À´Ï´Ù. ´Ù¸¸, width ¹× height°ªÀº À¯È¿ÇÕ´Ï´Ù. ºñ¾îÀÖ´Â Rectangle´Â ÁÂÇ¥ °ø°£¿¡ ÀÖ¾î À§Ä¡¸¦ °¡Á®, ºñ¾îÀÖ´Â Rectangle
»çÀÌÁî ¶Ç´Â À§Ä¡¸¦ º¯°æÇÏ´Â ¸Þ¼µåµµ À¯È¿ÇÕ´Ï´Ù. º¹¼öÀÇ Rectangle¿¡ ´ëÇÑ ¸Þ¼µå´Â ÀÌ·¯ÇÑ Rectangle °´Ã¼¾È¿¡ width ¶Ç´Â height°ªÀ¸·Î ÇØ¼ À߸øµÈ °ªÀ» °¡Áö´Â Rectangle °´Ã¼°¡ 1°³À̱⵵ ÇÑ °æ¿ì, µ¿ÀÛÀÌ º¸ÁõµÇÁö ¾Ê½À´Ï´Ù. ÀÌ·¯ÇÑ ¸Þ¼µå¿¡´Â intersects, intersection ¹× union°¡ ÀÖ½À´Ï´Ù.
| Áßø(Nested) Ŭ·¡½º °³¿ä |
|---|
| Ŭ·¡½º java.awt.geom. Rectangle2D ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
|---|
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 ¿µ¿ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
Rectangle2D |
getBounds2D ()
ÀÌ ±¸ÇüÀÇ °íÁ¤¹Ðµµ ¹Ù¿îµù¹Ú½º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
double |
getHeight ()
°æ°èÀÇ Rectangle ¿µ¿ªÀÇ ³ôÀ̸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù. |
Point |
getLocation ()
ÀÌ Rectangle
À§Ä¡¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Dimension |
getSize ()
¸®ÅÏµÈ Dimension·Î
³ªÅ¸³»Áø, ÀÌ Rectangle
»çÀÌÁ ¸®ÅÏÇÕ´Ï´Ù. |
double |
getWidth ()
°æ°èÀÇ Rectangle ¿µ¿ªÀÇ ³ÐÀ̸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù. |
double |
getX ()
°æ°èÀÇ Rectangle ¿µ¿ªÀÇ X ÁÂÇ¥¸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù. |
double |
getY ()
°æ°èÀÇ Rectangle ¿µ¿ªÀÇ 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 ¿µ¿ªÀ» x, y, width ¹× height·Î
ÁöÁ¤µÈ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù. |
void |
setBounds (Rectangle r)
ÀÌ Rectangle
°æ°èÀÇ Rectangle ¿µ¿ªÀ» ÁöÁ¤µÈ 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¸¦ ±¸ÃàÇÕ´Ï´Ù.
x - ÁöÁ¤µÈ x ÁÂÇ¥y - ÁöÁ¤µÈ y ÁÂÇ¥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
Á»󱸼®ÀÌ µÇ´Â Pointd - Rectangle
Æø°ú ³ôÀ̸¦ ³ªÅ¸³»´Â Dimensionpublic Rectangle(Point p)
Point·Î
Æø°ú ³ôÀ̰¡ ¾çÂÊ ¸ðµÎ 0 ÀÎ »õ·Î¿î Rectangle¸¦ ±¸ÃàÇÕ´Ï´Ù.
p - Rectangle
Á»󱸼®ÀÌ µÇ´Â Pointpublic Rectangle(Dimension d)
DimensionÀμö·Î ÁöÁ¤µÇ´Â »õ·Î¿î Rectangle¸¦ ±¸ÃàÇÕ´Ï´Ù.
d - Æø°ú ³ôÀ̸¦ ÁöÁ¤ÇÏ´Â Dimension| ¸Þ¼µåÀÇ »ó¼¼ |
|---|
public double getX()
Rectangle ¿µ¿ªÀÇ X ÁÂÇ¥¸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù.
RectangularShape ³»ÀÇ getX Rectangle ¿µ¿ªÀÇ x ÁÂÇ¥public double getY()
Rectangle ¿µ¿ªÀÇ Y ÁÂÇ¥¸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù.
RectangularShape ³»ÀÇ getY Rectangle ¿µ¿ªÀÇ y ÁÂÇ¥public double getWidth()
Rectangle ¿µ¿ªÀÇ ³ÐÀ̸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù.
RectangularShape ³»ÀÇ getWidth Rectangle ¿µ¿ªÀÇ Æøpublic double getHeight()
Rectangle ¿µ¿ªÀÇ ³ôÀ̸¦ double Á¤¹Ðµµ·Î ¸®ÅÏÇÕ´Ï´Ù.
RectangularShape ³»ÀÇ getHeight Rectangle ¿µ¿ªÀÇ ³ôÀÌpublic Rectangle getBounds()
Rectangle
°æ°èÀÇ Rectangle ¿µ¿ªÀ» ¸®ÅÏÇÕ´Ï´Ù.
ÀÌ ¸Þ¼µå´Â ¿ÏÀü¼ºÀ» À§Çؼ ÁغñµÇ¾î ÀÖ¾î¼,
Component
getBounds ¸Þ¼µå¿¡ ´ëÀÀÇÕ´Ï´Ù.
Shape ³»ÀÇ getBounds RectangularShape ³»ÀÇ getBounds Rectangle. ÀÌ Rectangle
°æ°èÀÇ Rectangle ¿µ¿ª¿¡ µ¿ÀÏÇÑComponent.getBounds(),
setBounds(Rectangle),
setBounds(int, int, int, int) public Rectangle2D getBounds2D()
Shape ³»ÀÇ getBounds2D Rectangle2D ³»ÀÇ getBounds2D Rectangle2D
¹Ù¿îµù¹Ú½º
Shape.getBounds() public void setBounds(Rectangle r)
Rectangle
°æ°èÀÇ Rectangle ¿µ¿ªÀ» ÁöÁ¤µÈ Rectangle¿¡ ÀÏÄ¡Çϵµ·Ï ¼³Á¤ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼µå´Â ¿ÏÀü¼ºÀ» À§Çؼ ÁغñµÇ¾î ÀÖ¾î¼,
Component
setBounds ¸Þ¼µå¿¡ ´ëÀÀÇÕ´Ï´Ù.
r - ÁöÁ¤µÈ RectanglegetBounds(),
Component.setBounds(java.awt.Rectangle)
public void setBounds(int x,
int y,
int width,
int height)
Rectangle
°æ°èÀÇ Rectangle ¿µ¿ªÀ» x, y, width ¹× height·Î
ÁöÁ¤µÈ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼µå´Â ¿ÏÀü¼ºÀ» À§Çؼ ÁغñµÇ¾î ÀÖ¾î¼,
Component
setBounds ¸Þ¼µå¿¡ ´ëÀÀÇÕ´Ï´Ù.
x - ÀÌ Rectangle
Á»󱸼®ÀÇ »õ·Î¿î x ÁÂÇ¥y - ÀÌ Rectangle
Á»󱸼®ÀÇ »õ·Î¿î y ÁÂÇ¥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 x - ÁöÁ¤µÈ ±¸ÇüÀÇ Á»󱸼®ÀÇ x ÁÂÇ¥y - ÁöÁ¤µÈ ±¸ÇüÀÇ Á»󱸼®ÀÇ y ÁÂÇ¥width - Dimension °´Ã¼ÀÇ »õ·Î¿î Æøheight - Dimension °´Ã¼ÀÇ »õ·Î¿î ³ôÀÌ
@Deprecated
public void reshape(int x,
int y,
int width,
int height)
setBounds(int, int, int, int)¸¦ »ç¿ëÇÕ´Ï´Ù.
Rectangle
°æ°èÀÇ Rectangle ¿µ¿ªÀ» x, y, width ¹× height·Î
ÁöÁ¤µÈ °ªÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù.
x - ÀÌ Rectangle
Á»󱸼®ÀÇ »õ·Î¿î x ÁÂÇ¥y - ÀÌ Rectangle
Á»󱸼®ÀÇ »õ·Î¿î y ÁÂÇ¥width - ÀÌ Rectangle
»õ·Î¿î Æøheight - ÀÌ Rectangle
»õ·Î¿î ³ôÀÌpublic Point getLocation()
Rectangle
À§Ä¡¸¦ ¸®ÅÏÇÕ´Ï´Ù.
ÀÌ ¸Þ¼µå´Â ¿ÏÀü¼ºÀ» À§Çؼ ÁغñµÇ¾î ÀÖ¾î¼,
Component
getLocation ¸Þ¼µå¿¡ ´ëÀÀÇÕ´Ï´Ù.
Rectangle
Á»󱸼®ÀÇ PointComponent.getLocation(),
setLocation(Point),
setLocation(int, int) public void setLocation(Point p)
Rectangle°¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼µå´Â ¿ÏÀü¼ºÀ» À§Çؼ ÁغñµÇ¾î ÀÖ¾î¼,
Component
setLocation ¸Þ¼µå¿¡ ´ëÀÀÇÕ´Ï´Ù.
p - ÀÌ Rectangle
»õ·Î¿î À§Ä¡¸¦ ÁöÁ¤ÇÏ´Â PointComponent.setLocation(java.awt.Point),
getLocation()
public void setLocation(int x,
int y)
Rectangle°¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
ÀÌ ¸Þ¼µå´Â ¿ÏÀü¼ºÀ» À§Çؼ ÁغñµÇ¾î ÀÖ¾î¼,
Component
setLocation ¸Þ¼µå¿¡ ´ëÀÀÇÕ´Ï´Ù.
x - »õ·Î¿î À§Ä¡ÀÇ x ÁÂÇ¥y - »õ·Î¿î À§Ä¡ÀÇ y ÁÂÇ¥getLocation(),
Component.setLocation(int, int)
@Deprecated
public void move(int x,
int y)
setLocation(int, int)¸¦ »ç¿ëÇÕ´Ï´Ù.
Rectangle°¡ ÁöÁ¤µÈ À§Ä¡·Î À̵¿ÇÕ´Ï´Ù.
x - »õ·Î¿î À§Ä¡ÀÇ x ÁÂÇ¥y - »õ·Î¿î À§Ä¡ÀÇ y ÁÂÇ¥
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
»çÀÌÁ ³ªÅ¸³»´Â DimensionComponent.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()
@Deprecated
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)¿¡ ÀÖ´Â Á¡À» Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
x - ÁöÁ¤µÈ x ÁÂÇ¥y - ÁöÁ¤µÈ y ÁÂÇ¥
Rectangle
³»ºÎ¿¡ ÀÖ´Â °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falsepublic 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°¡ ¿ÏÀüÇÏ°Ô Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
X - ÁöÁ¤µÈ x ÁÂÇ¥Y - ÁöÁ¤µÈ y ÁÂÇ¥W - Rectangle
ÆøH - Rectangle
³ôÀÌ
Rectangle°¡ ¿ÏÀüÇÏ°Ô ÀÌ Rectangle ³»¿¡ µé¾î°¡´Â °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
@Deprecated
public boolean inside(int X,
int Y)
contains(int, int)·Î
¿Å°ÜÁ³½À´Ï´Ù.
Rectangle°¡
ÁöÁ¤µÈ À§Ä¡ (X, Y)¿¡ ÀÖ´Â Á¡À» Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù.
X - ÁöÁ¤µÈ x ÁÂÇ¥Y - ÁöÁ¤µÈ y ÁÂÇ¥
Rectangle
³»ºÎ¿¡ ÀÖ´Â °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falsepublic boolean intersects(Rectangle r)
Rectangle¿Í
ÁöÁ¤µÈ Rectangle°¡ ±³Â÷ÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. °øÅë ºÎºÐÀÌ ºñ¾îÀÖÁö ¾ÊÀº °æ¿ì, 2°³ÀÇ ±¸ÇüÀº ±³Â÷ÇÕ´Ï´Ù.
r - ÁöÁ¤µÈ Rectangle
Rectangle °÷ÀÇ Rectangle°¡ ¼·Î °ãÄ¡´Â °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falsepublic 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¸¦ ¸®ÅÏÇÕ´Ï´Ù.
newx - »õ·Î¿î Á¡ÀÇ x ÁÂÇ¥newy - »õ·Î¿î Á¡ÀÇ y ÁÂÇ¥public void add(Point pt)
Rectangle¿¡
ÁöÁ¤µÈ Point¸¦ Ãß°¡ÇÕ´Ï´Ù. ÀÌ °á°ú, ¿øÀÇ Rectangle¿Í
ÁöÁ¤µÈ Point
¾çÂÊ ¸ðµÎ¸¦ Æ÷ÇÔÇÑ ÃÖ¼ÒÀÇ Rectangle°¡ ÀÛ¼ºµË´Ï´Ù.
Point¸¦ Ãß°¡ÇÑ ÈÄ¿¡
Ãß°¡µÈ Point¸¦ Àμö·Î¼ ÁöÁ¤ÇØ contains¸¦ È£ÃâÇßÀ» °æ¿ì, ¹Ýµå½Ã true°¡ ¸®Åϵȴٰí´Â ÇÒ ¼ö ¾ø½À´Ï´Ù. contains ¸Þ¼µå´Â Rectangle
¿ì´Ü ¶Ç´Â ÇÏ´Ü¿¡ À§Ä¡ÇÏ´Â Á¡ÀÇ °æ¿ì´Â true¸¦ µ¹·ÁÁÖÁö ¾Ê½À´Ï´Ù. ±× ¶§¹®¿¡
Ãß°¡µÈ PointÀÌ È®´ë ÈÄÀÇ Rectangle
¿ì´Ü ¶Ç´Â ÇÏ´Ü¿¡ À§Ä¡ÇÏ´Â Á¡ÀÎ °æ¿ì¿¡´Â contains´Â Point¿¡ ´ëÇØ¼ false¸¦ ¸®ÅÏÇÕ´Ï´Ù.
pt - ÀÌ Rectangle¿¡ Ãß°¡µÇ´Â »õ·Î¿î Pointpublic 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 x - ÁöÁ¤µÈ x ÁÂÇ¥y - ÁöÁ¤µÈ y ÁÂÇ¥
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
¾çÂÊ ¸ðµÎ¿¡ Æ÷ÇԵǴ ÃÖ´ëÀÇ Rectangle2Dpublic Rectangle2D createUnion(Rectangle2D r)
Rectangle¿Í
ÁöÁ¤µÈ Rectangle2D¿Í
ÀÇ °áÇÕ ºÎºÐÀ» ³ªÅ¸³»´Â »õ·Î¿î Rectangle2D °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
Rectangle2D ³»ÀÇ createUnion r - ÀÌ Rectangle¿Í
°áÇյǴ Rectangle2D
Rectangle2D °÷ÀÇ Rectangle
¾çÂÊ ¸ðµÎ¸¦ Æ÷ÇÔÇÑ ÃÖ¼ÒÀÇ Rectangle2Dpublic boolean equals(Object obj)
Àμö°¡ nullÀÌ ¾Æ´Ï°í, ÀÌ Rectangle¿Í
°°Àº Á»󱸼®, ³ôÀÌ ¹× ³ÐÀ̸¦ °¡Áö´Â Rectangle °´Ã¼ÀÎ °æ¿ì¿¡¸¸, °á°ú´Â true°¡ µË´Ï´Ù.
Rectangle2D ³»ÀÇ equals obj - ÀÌ Rectangle¿Í
ºñ±³ÇÏ´Â Object
true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falseObject.hashCode(),
Hashtable public String toString()
Rectangle ¹× ±× °ªÀ» ³ªÅ¸³»´Â String Ç¥ÇöÀ» ¸®ÅÏÇÕ´Ï´Ù.
Object ³»ÀÇ toString Rectangle °´Ã¼ÀÇ ÁÂÇ¥¿Í »çÀÌÁîÀÇ °ªÀ» ³ªÅ¸³»´Â String
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
| °³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.