|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
| ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
| °³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå | ||||||||||
java.lang.Object | +--java.awt.EventQueue
EventQueue ´Â ¾î´À Ç÷§ÆûÀ¸·Îµµ °øÅëÀÇ Å¬·¡½ºÀ̸ç, ºÎÇÏÀÇ ÇǾî Ŭ·¡½º¿Í ½Å·ÚÇÒ ¼ö ÀÖ´Â ¾îÇø®ÄÉÀÌ¼Ç Å¬·¡½º·ÎºÎÅÍÀÇ À̺¥Æ®¸¦ Å¥¿¡ ³Ö½À´Ï´Ù.
ÀÌ EventQueue ¿¡ ´ëÇØ¼, µð½ºÆÌÄ¡ ´ë»óÀÇ À̺¥Æ®¸¦ Àμö·Î¼ dispatchEvent(AWTEvent) ¸Þ¼Òµå¸¦ È£ÃâÇØ, À̺¥Æ®¸¦ Å¥·ÎºÎÅÍ ÃßÃâÇØ µð½ºÆÌÄ¡¸¦ ½Ç½ÃÇÏ´Â ºñµ¿±â À̺¥Æ®µð½ºÆÌÄ¡ ±â´ÉÀ» ĸ½¶ÈÇÕ´Ï´Ù. ÀÌ ±â´ÉÀÇ ÀϺÎÀÇ µ¿ÀÛÀº ±¸Çö¿¡ ÀÇÇØ ¹Ù²ò´Ï´Ù. Á¶°ÇÀº ½ÇÁ¦·Î ÀÌ Å¥¿¡ ³Ö¾îÁø À̺¥Æ®¸¦ µð½ºÆÌÄ¡ ÇÑ´Ù°í ÇÏ´Â °Í »ÓÀÔ´Ï´Ù. EventQueue ¿¡ ¼Û½ÅÁßÀÇ À̺¥Æ®´Â Å¥¿¡ ³Ö¾îÁø °Í °Í°ú °°ÀÌ Ãë±ÞÇÒ ¼ö°¡ ÀÖ½À´Ï´Ù.
AWTEvent A °¡ AWTEvent B º¸´Ù Àü¿¡ EventQueue ¿¡ ³Ö¾îÁö°í ÀÖ´Â °æ¿ì, À̺¥Æ® B ¸¦ À̺¥Æ® A º¸´Ù Àü¿¡ µð½ºÆÌÄ¡ ÇÒ ¼ö ¾ø½À´Ï´Ù.
ºê¶ó¿ìÀú¿¡ µû¶ó¼´Â ÄÚµå º£À̽º°¡ ´Ù¸¥ ¾ÖÇø´À» °³º°ÀÇ ¹®¸Æ¿¡ ºÐÇÒÇØ, ÀÌ·¯ÇÑ ¹®¸ÆÀ» µ¶¸³ÇØ Ãë±ÞÇÏ´Â °ÍÀÌ ÀÖ½À´Ï´Ù. ÀÌ °æ¿ì, °¢ ¹®¸Æ ¸¶´Ù 1 °³ÀÇ EventQueue °¡ Á¸ÀçÇÏ°Ô µË´Ï´Ù. ¸ðµç ¾ÖÇø´À» °°Àº ¹®¸Æ¿¡ µÎ¾î, 1 °³ÀÇ ±Û·Î¹ú EventQueue ·Î ¸ðµç ¾ÖÇø´À» µ¿ÀÛ½ÃŰ´Â ºê¶ó¿ìÀúµµ ÀÖ½À´Ï´Ù. ÀÌ µ¿ÀÛÀº ±¸Çö¿¡ ÀÇÇØ °áÁ¤µË´Ï´Ù. ÀÚ¼¼ÇÑ °ÍÀº ºê¶ó¿ìÀúÀÇ ¹®¼¸¦ ÂüÁ¶ÇØ ÁÖ¼¼¿ä.
| »ý¼ºÀÚÀÇ °³¿ä | |
EventQueue ()
|
|
| ¸Þ¼ÒµåÀÇ °³¿ä | |
protected void |
dispatchEvent (AWTEvent event)
À̺¥Æ®¸¦ µð½ºÆÌÄ¡ ÇÕ´Ï´Ù. |
static AWTEvent |
getCurrentEvent ()
ºÒ·Á °£ thread¿¡ °ü·ÃÁöÀ» ¼ö ÀÖ¾ú´ø EventQueue ¿¡ ÇöÀç µð½ºÆÌÄ¡ µÇ°í ÀÖ´Â À̺¥Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. |
static long |
getMostRecentEventTime ()
ºÒ·Á °£ thread¿¡ °ü·ÃÁöÀ» ¼ö ÀÖ¾ú´ø EventQueue ·ÎºÎÅÍ µð½ºÆÌÄ¡ µÈ, Á¦ÀÏ »õ·Î¿î ŸÀÓ ½ºÅÆÇÁ¸¦ °¡Áö´Â À̺¥Æ®ÀÇ Å¸ÀÓ ½ºÅÆÇÁ¸¦ µ¹·ÁÁÝ´Ï´Ù. |
AWTEvent |
getNextEvent ()
EventQueue ·ÎºÎÅÍ À̺¥Æ®¸¦ »èÁ¦ÇØ, ±× À̺¥Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. |
static void |
invokeAndWait (Runnable runnable)
runnable ÀÇ run ¸Þ¼Òµå°¡ EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µå·Î ºÒ·Á °¡µµ·Ï(µíÀÌ) ÇÕ´Ï´Ù. |
static void |
invokeLater (Runnable runnable)
runnable ÀÇ run ¸Þ¼Òµå°¡ EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µå·Î ºÒ·Á °¡µµ·Ï(µíÀÌ) ÇÕ´Ï´Ù. |
static boolean |
isDispatchThread ()
È£ÃâÃø thread°¡ ÇöÀçÀÇ AWT EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µåÀÇ °æ¿ì¿¡ true ¸¦ µ¹·ÁÁÝ´Ï´Ù. |
AWTEvent |
peekEvent ()
EventQueue ÀÇ ÃÖÃÊÀÇ À̺¥Æ®¸¦ »èÁ¦ÇÏÁö ¾Ê°í µ¹·ÁÁÝ´Ï´Ù. |
AWTEvent |
peekEvent (int id)
ÁöÁ¤µÈ ID ¸¦ °¡Áö´Â À̺¥Æ®°¡ ÀÖ´Â °æ¿ì, ±× ÁßÀÇ ÃÖÃÊÀÇ À̺¥Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. |
protected void |
pop ()
ÀÌ EventQueue ¸¦ »ç¿ëÇÏ´Â À̺¥Æ®ÀÇ µð½ºÆÌÄ¡¸¦ Á¤ÁöÇÕ´Ï´Ù. |
void |
postEvent (AWTEvent theEvent)
1. 1 Çü½ÄÀÇ À̺¥Æ®¸¦ EventQueue ¿¡ ¼Û½ÅÇÕ´Ï´Ù. |
void |
push (EventQueue newEventQueue)
±âÁ¸ÀÇ EventQueue ¸¦, ÁöÁ¤µÈ EventQueue ·Î ¿Å°Ü³õ½À´Ï´Ù. |
| Ŭ·¡½º java.lang. Object ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| »ý¼ºÀÚÀÇ »ó¼¼ |
public EventQueue()
| ¸Þ¼ÒµåÀÇ »ó¼¼ |
public void postEvent(AWTEvent theEvent)
EventQueue ¿¡ ¼Û½ÅÇÕ´Ï´Ù. °°Àº ID ¹× À̺¥Æ® ¼Ò½º¸¦ °¡Áö´Â Å¥¿¡ À̺¥Æ®°¡ ÀÖ´Â °æ¿ì´Â ¼Ò½º Component ÀÇ coalesceEvents ¸Þ¼Òµå°¡ ºÒ·Á °©´Ï´Ù.
theEvent - java.awt.AWTEvent ÀÇ ÀνºÅϽº, ¶Ç´Â ±× ¼ºê Ŭ·¡½º
public AWTEvent getNextEvent()
throws InterruptedException
EventQueue ·ÎºÎÅÍ À̺¥Æ®¸¦ »èÁ¦ÇØ, ±× À̺¥Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â ´Ù¸¥ thread¿¡ ÀÇÇØ À̺¥Æ®°¡ ¼Û½ÅµÉ ¶§±îÁö ºí·Ï µË´Ï´Ù.
AWTEvent
InterruptedException - º°ÀÇ thread°¡ ÀÌ thread¿¡ ³¢¾îµé¾úÀ» °æ¿ìpublic AWTEvent peekEvent()
EventQueue ÀÇ ÃÖÃÊÀÇ À̺¥Æ®¸¦ »èÁ¦ÇÏÁö ¾Ê°í µ¹·ÁÁÝ´Ï´Ù.
public AWTEvent peekEvent(int id)
id - ¿ä±¸ÇÏ´Â À̺¥Æ® ŸÀÔÀÇ ID
nullprotected void dispatchEvent(AWTEvent event)
| À̺¥Æ® ŸÀÔ | ¼Ò½º ŸÀÔ | µð½ºÆÌÄ¡ ¹æ¹ý |
|---|---|---|
| ActiveEvent | Any | event.dispatch() |
| ±× ¿Ü | Component | source.dispatchEvent(AWTEvent) |
| ±× ¿Ü | MenuComponent | source.dispatchEvent(AWTEvent) |
| ±× ¿Ü | ±× ¿Ü | 󸮵ÇÁö ¾Ê´Â´Ù (¹«½ÃµÈ´Ù) |
public static long getMostRecentEventTime()
EventQueue ·ÎºÎÅÍ µð½ºÆÌÄ¡ µÈ, Á¦ÀÏ »õ·Î¿î ŸÀÓ ½ºÅÆÇÁ¸¦ °¡Áö´Â À̺¥Æ®ÀÇ Å¸ÀÓ ½ºÅÆÇÁ¸¦ µ¹·ÁÁÝ´Ï´Ù. ŸÀÓ ½ºÅÆÇÁ¸¦ °¡Áö´Â À̺¥Æ®°¡ µð½ºÆÌÄ¡ÁßÀÇ °æ¿ì, ±× ŸÀÓ ½ºÅÆÇÁ°¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù. À̺¥Æ®°¡ ÀüÇô µð½ºÆÌÄ¡µÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì, EventQueue °¡ ÃʱâÈµÈ ½Ã°£ÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù. Java platform SDK ÀÇ ÇöÀçÀÇ ¹öÁ¯¿¡¼´Â InputEvent,ActionEvent, ¹× InvocationEvent ¸¸ÀÌ Å¸ÀÓ ½ºÅÆÇÁ¸¦ °¡Áý´Ï´Ù¸¸, Àå·¡ÀÇ ¹öÁ¯¿¡¼´Â ´Ù¸¥ À̺¥Æ® ŸÀÔ¿¡µµ ŸÀÓ ½ºÅÆÇÁ°¡ Ãß°¡µÉ °¡´É¼ºÀÌ ÀÖ½À´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â ¾îÇø®ÄÉÀ̼ÇÀÇ À̺¥Æ®µð½ºÆÌÄ¡½º·¿µå·ÎºÎÅ͸¸ È£ÃâÇϵµ·Ï ÇØ ÁÖ¼¼¿ä. ´Ù¸¥ thread·ÎºÎÅÍ È£ÃâÇßÀ» °æ¿ì,System.currentTimeMillis() ·Î ¸®Æ÷Æ®µÇ´Â ÇöÀçÀÇ ½Ã½ºÅÛ ½Ã°¢ÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù.
InputEvent,ActionEvent, ¶Ç´Â InvocationEvent ÀÇ Å¸ÀÓ ½ºÅÆÇÁ. ÀÌ ¸Þ¼Òµå°¡ À̺¥Æ®µð½ºÆÌÄ¡½º·¿µå Àܷ̿κÎÅÍ ºÒ·Á °¡´Â °æ¿ì´Â System.currentTimeMillis()InputEvent.getWhen() ,
ActionEvent.getWhen() ,
InvocationEvent.getWhen() public static AWTEvent getCurrentEvent()
EventQueue ¿¡ ÇöÀç µð½ºÆÌÄ¡ µÇ°í ÀÖ´Â À̺¥Æ®¸¦ µ¹·ÁÁÝ´Ï´Ù. ¸Þ¼Òµå°¡ À̺¥Æ®¿¡ ¾×¼¼½º ÇÒ Çʿ䰡 ÀÖ¾î, À̺¥Æ®¿¡ÀÇ ÂüÁ¶¸¦ Àμö·Î¼ ¹Þµµ·Ï(µíÀÌ) ¼³°èµÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì¿¡ À¯È¿ÇÕ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â ¾îÇø®ÄÉÀ̼ÇÀÇ À̺¥Æ®µð½ºÆÌÄ¡½º·¿µå·ÎºÎÅ͸¸ È£ÃâÇϵµ·Ï ÇØ ÁÖ¼¼¿ä. ´Ù¸¥ thread·ÎºÎÅÍ È£ÃâÇßÀ» °æ¿ì, null °¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù.
public void push(EventQueue newEventQueue)
EventQueue ¸¦, ÁöÁ¤µÈ EventQueue ·Î ¿Å°Ü³õ½À´Ï´Ù. ´ë±â »óÅÂÀÇ À̺¥Æ®´Â 󸮸¦ À§Çؼ(¶§¹®¿¡) »õ·Î¿î EventQueue ¿¡ Àü¼Û µË´Ï´Ù.
newEventQueue - »ç¿ëµÇ´Â EventQueue ¶Ç´Â ±× ¼ºê Ŭ·¡½ºÀÇ ÀνºÅϽºpop()
protected void pop()
throws EmptyStackException
EventQueue ¸¦ »ç¿ëÇÏ´Â À̺¥Æ®ÀÇ µð½ºÆÌÄ¡¸¦ Á¤ÁöÇÕ´Ï´Ù. ´ë±â »óÅÂÀÇ À̺¥Æ®´Â 󸮸¦ À§Çؼ(¶§¹®¿¡) ÀüÀÇ EventQueue ¿¡ Àü¼Û µË´Ï´Ù.
°æ°í - µ¥µå ·Ï ȸÇǸ¦ À§ÇØ, ÀÌ ¸Þ¼Òµå¸¦ ¼ºê Ŭ·¡½º¿¡¼ µ¿±â ¼±¾ðÇÏÁö ¾Ê°Ô ÇÕ´Ï´Ù.
EmptyStackException - ÀÌ EventQueue ·Î ÀÌÀü¿¡ Ǫ½¬¸¦ ÇÏÁö ¾ÊÀº °æ¿ìpush(java.awt.EventQueue) public static boolean isDispatchThread()
EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µåÀÇ °æ¿ì¿¡ true ¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ ¸Þ¼Òµå¸¦ »ç¿ëÇϸé(ÀÚ), ÁöÁ¤µÈ ŽºÅ©¸¦ ÇöÀçÀÇ AWT EventDispatchThread ·Î È®½ÇÈ÷ ½ÇÇà½ÃŰ´Â (¶Ç´Â ½ÇÇà½ÃŰÁö ¾Ê°Ô ÇÑ´Ù) ÀÏÀÌ »ý±é´Ï´Ù.
EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µå·Î µ¿ÀÛÇϰí ÀÖ´Â °æ¿ì´Â truepublic static void invokeLater(Runnable runnable)
runnable ÀÇ run ¸Þ¼Òµå°¡ EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µå·Î ºÒ·Á °¡µµ·Ï(µíÀÌ) ÇÕ´Ï´Ù. ´ë±â »óÅÂÀÇ ¸ðµç À̺¥Æ®°¡ ó¸®µÈ ÈÄ¿¡ ºÒ·Á °©´Ï´Ù.
runnable - run ¸Þ¼Òµå°¡ EventQueue ·Î µ¿±â ½ÇÇàµÇÁö ¾ÊÀ¸¸é ¾È µÇ´Â RunnableinvokeAndWait(java.lang.Runnable)
public static void invokeAndWait(Runnable runnable)
throws InterruptedException ,
InvocationTargetException
runnable ÀÇ run ¸Þ¼Òµå°¡ EventQueue ÀÇ µð½ºÆÌÄ¡½º·¿µå·Î ºÒ·Á °¡µµ·Ï(µíÀÌ) ÇÕ´Ï´Ù. ´ë±â »óÅÂÀÇ ¸ðµç À̺¥Æ®°¡ ó¸®µÈ ÈÄ¿¡ ½ÇÇàµË´Ï´Ù. È£ÃâÀº À̰ÍÀÌ ½ÇÇàµÉ ¶§±îÁö ºí·Ï µË´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â À̺¥Æ® µð½ºÆÖÃÄ thread·ÎºÎÅÍ ºÒ·Á °¡¸é(ÀÚ) Error ¸¦ ½½·Î¿ì ÇÕ´Ï´Ù.
runnable - run ¸Þ¼Òµå°¡ EventQueue ·Î µ¿±â ½ÇÇàµÇÁö ¾ÊÀ¸¸é ¾È µÇ´Â Runnable
InterruptedException - º°ÀÇ thread°¡ ÀÌ thread¿¡ ³¢¾îµé¾úÀ» °æ¿ì
InvocationTargetException - runnable ÀÇ µ¿ÀÛÁß¿¡ ¿¹¿Ü°¡ ½½·Î¿ì µÇ´Â °æ¿ìinvokeLater(java.lang.Runnable)
|
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.