|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPopupMenu
public class JPopupMenu
pop-up menuÀÇ ±¸ÇöÀÔ´Ï´Ù. pop-up menu´Â ÀÛÀº À©µµ¿ì·Î º¹¼öÀÇ ¼±ÅûçÇ× (¸Þ´º Ä¿¸àµå)À» Ç¥½ÃÇÕ´Ï´Ù. JPopupMenu
´Â
µµ±¸¸ðÀ½»óÀÇ Ç׸ñÀÌ ¼±ÅõǾúÀ» ¶§¿¡ Ç¥½ÃÇÏ´Â ¸Þ´º¿¡ »ç¿ëÇÕ´Ï´Ù. ¶Ç, ¼±ÅÃÇÑ ¸Þ´º Ç׸ñ¿¡ µû¶ó¼´Â Ç¥½ÃµÇ´Â Àϵµ ÀÖ´Â ÇÁ¸£¶óÀÌÆ®¸Þ´º¿¡µµ »ç¿ëµË´Ï´Ù. ȤÀº ¸Þ´º¸¦ Ç¥½Ã½ÃŰ°í ½ÍÀº ´Ù¸¥ Àå¼Ò (µµ±¸¸ðÀ½ ÀÌ¿ÜÀÇ Àå¼Ò)¿¡¼µµ, JPopupMenu
¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î
ƯÁ¤ÀÇ Àå¼Ò¿¡¼ ¿À¸¥ÂÊ Å¬¸¯ÀÌ ¹ß»ýÇßÀ» °æ¿ìÀÇ pop-up menu Ç¥½Ã (¼îÆ® ÄÆ ¸Þ´º) µîÀÔ´Ï´Ù.
pop-up menuÀÇ »ç¿ë ¹æ¹ýÀÇ »ó¼¼¿Í ¿¹¿¡ ´ëÇØ¼´Â ¡¸The Java Tutorial¡¹ÀÇ ¡¸How to Use Menus¡¹¸¦ ÂüÁ¶ÇϽʽÿÀ.
°æ°í: ÀÌ Å¬·¡½ºÀÇ Á÷·ÄÈ µÈ °´Ã¼´Â ÇâÈÄÀÇ Swing ¸±¸®Áî¿Í
ȣȯµÇÁö ¾ÊÀ» ¿¹Á¤ÀÔ´Ï´Ù. ÇöÀçÀÇ Á÷·ÄÈÀÇ Áö¿øÀº
´Ü±â°£ÀÇ ¿î¿ëÀ̳ª, °°Àº ¹öÀüÀÇ Swing¸¦ ½ÇÇàÇÏ´Â ¾îÇø®ÄÉÀ̼ǰ£ÀÇ RMI¿¡ ÀûÀýÇϰí ÀÖ½À´Ï´Ù. JDK ¹öÀü
1.4 ÀÌÈÄ, ¸ðµç JavaBeans™
Àå±â°£ÀÇ ¿î¿ë Áö¿øÀº
java.beans
ÆÐŰÁö¿¡ Ãß°¡µÇ°í ÀÖ½À´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº XMLEncoder
¸¦
ÂüÁ¶ÇϽʽÿÀ.
Áßø(Nested) Ŭ·¡½º °³¿ä | |
---|---|
protected class |
JPopupMenu.AccessibleJPopupMenu
ÀÌ Å¬·¡½º´Â JPopupMenu Ŭ·¡½º¿ëÀÇ »ç¿ëÀÚ
º¸Á¶ ±â´ÉÀÇ Áö¿ø¸¦ ±¸ÇöÇϰí ÀÖ½À´Ï´Ù. |
static class |
JPopupMenu.Separator
pop-up menu °íÀ¯ÀÇ separatorÀÔ´Ï´Ù. |
Ŭ·¡½º javax.swing. JComponent ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
---|
JComponent.AccessibleJComponent |
Ŭ·¡½º java.awt. Container ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
---|
Container.AccessibleAWTContainer |
Ŭ·¡½º java.awt. Component ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
---|
Component.AccessibleAWTComponent,
Component.BltBufferStrategy,
Component.FlipBufferStrategy |
ÇÊµå °³¿ä |
---|
Ŭ·¡½º javax.swing. JComponent ·ÎºÎÅÍ »ó¼ÓµÈ Çʵå |
---|
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Ŭ·¡½º java.awt. Component ·ÎºÎÅÍ »ó¼ÓµÈ Çʵå |
---|
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
ÀÎÅÍÆäÀ̽º java.awt.image. ImageObserver ·ÎºÎÅÍ »ó¼ÓµÈ Çʵå |
---|
ABORT,
ALLBITS,
ERROR,
FRAMEBITS,
HEIGHT,
PROPERTIES,
SOMEBITS,
WIDTH |
»ý¼ºÀÚ °³¿ä | |
---|---|
JPopupMenu ()
È£Ãâ ÄÄÆÛ³ÍÆ®¸¦ Á¤ÀÇÇÏÁö ¾Ê°í JPopupMenu ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
JPopupMenu (String label)
ÁöÁ¤µÈ ŸÀÌÆ²ÀÇ PopupMenu ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
¸Þ¼µå °³¿ä | |
---|---|
JMenuItem |
add (Action a)
¸Þ´ºÀÇ ¸»¹Ì¿¡ ÁöÁ¤µÈ Action °´Ã¼¸¦ ¹èºÐÇÏ´Â ¸Þ´º Ç׸ñÀ» Ãß°¡ÇÕ´Ï´Ù. |
JMenuItem |
add (JMenuItem menuItem)
ÁöÁ¤µÈ ¸Þ´º Ç׸ñÀ» ¸Þ´ºÀÇ ¸»¹Ì¿¡ Ãß°¡ÇÕ´Ï´Ù. |
JMenuItem |
add (String s)
ÁöÁ¤µÈ ÅØ½ºÆ®¸¦ °¡Áö´Â »õ·Î¿î ¸Þ´º Ç׸ñÀ» ÀÛ¼ºÇØ, ÀÌ ¸Þ´ºÀÇ ¸»¹Ì¿¡ Ãß°¡ÇÕ´Ï´Ù. |
void |
addMenuKeyListener (MenuKeyListener l)
pop-up menu¿¡ MenuKeyListener ¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
addPopupMenuListener (PopupMenuListener l)
PopupMenu ¸®½º³Ê¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
addSeparator ()
¸Þ´ºÀÇ ¸»¹Ì¿¡ »õ·Î¿î separator¸¦ Ãß°¡ÇÕ´Ï´Ù. |
protected PropertyChangeListener |
createActionChangeListener (JMenuItem b)
Action ¿¡ ´ëÇÑ º¯°æÀÌ ¹ß»ýÇßÀ» °æ¿ì¿¡ ÄÁÆ®·ÑÀ» °»½ÅÇÑ´Ù, ÀûÀýÈ÷ ¼³Á¤µÈ PropertyChangeListener ¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
protected JMenuItem |
createActionComponent (Action a)
JPopupMenu ¿¡ Ãß°¡µÈ Action
JMenuItem ¸¦ ÀÛ¼ºÇÏ´Â ÆÑÅ丮 ¸Þ¼µåÀÔ´Ï´Ù. |
protected void |
firePopupMenuCanceled ()
PopupMenuListener ¿¡
pop-up menu°¡ »èÁ¦µÈ °ÍÀ» ÅëÁöÇÕ´Ï´Ù. |
protected void |
firePopupMenuWillBecomeInvisible ()
PopupMenuListener ¿¡
pop-up menu°¡ ºÒ°¡½Ã°¡ µÇ´Â °ÍÀ» ÅëÁöÇÕ´Ï´Ù. |
protected void |
firePopupMenuWillBecomeVisible ()
PopupMenuListener ¿¡
pop-up menu°¡ °¡½Ã°¡ µÇ´Â °ÍÀ» ÅëÁöÇÕ´Ï´Ù. |
AccessibleContext |
getAccessibleContext ()
ÀÌ JPopupMenu¿¡ °ü·ÃÇÑ AccessibleContext¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Component |
getComponent ()
ÀÌ JPopupMenu ÄÄÆÛ³ÍÆ®¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Component |
getComponentAtIndex (int i)
ÃßõÇÏÁö ¾Ê½À´Ï´Ù. getComponent(int i) ·Î
¿Å°ÜÁ³½À´Ï´Ù. |
int |
getComponentIndex (Component c)
ÁöÁ¤µÈ ÄÄÆÛ³ÍÆ®ÀÇ À妽º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
static boolean |
getDefaultLightWeightPopupEnabled ()
defaultLightWeightPopupEnabled ÇÁ·ÎÆÛƼ¸¦ ÃëµæÇÕ´Ï´Ù. |
Component |
getInvoker ()
pop-up menuÀÇ È£Ãâ ÄÄÆÛ³ÍÆ®¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
String |
getLabel ()
pop-up menuÀÇ ¶óº§À» ¸®ÅÏÇÕ´Ï´Ù. |
Insets |
getMargin ()
pop-up menuÀÇ º¸´õ¿Í ³»¿ëÀÇ »çÀÌ¿¡ ÀÖ´Â ¸¶ÁøÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù (Çȼ¿ ´ÜÀ§). |
MenuKeyListener [] |
getMenuKeyListeners ()
ÀÌ JPopupMenu¿¡ addMenuKeyListener()·Î Ãß°¡µÈ ¸ðµç MenuKeyListener
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
PopupMenuListener [] |
getPopupMenuListeners ()
ÀÌ JMenuItem¿¡ addPopupMenuListener()·Î Ãß°¡µÈ ¸ðµç PopupMenuListener
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
SingleSelectionModel |
getSelectionModel ()
´ÜÀÏÀÇ ¼±ÅÃÀ» Ãë±ÞÇÏ´Â ¸ðµ¨ °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
MenuElement [] |
getSubElements ()
ÀÌ ¸Þ´º ÄÄÆÛ³ÍÆ®ÀÇ ºÎ¸Þ´º¸¦ Æ÷ÇÔÇÏ´Â MenuElement
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
PopupMenuUI |
getUI ()
ÀÌ ÄÄÆÛ³ÍÆ®¸¦ ·»´õ¸µ ÇÏ´Â Look & Feel (L&F) °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
String |
getUIClassID ()
ÀÌ ÄÄÆÛ³ÍÆ®¸¦ ·»´õ¸µ ÇÏ´Â L&F Ŭ·¡½ºÀÇ À̸§À» ¸®ÅÏÇÕ´Ï´Ù. |
void |
insert (Action a,
int index)
ÁöÁ¤µÈ Action °´Ã¼¸¦, ¸Þ´º Ç׸ñÀ¸·Î¼ ÁöÁ¤ÀÇ À§Ä¡¿¡ »ðÀÔÇÕ´Ï´Ù. |
void |
insert (Component component,
int index)
ÁöÁ¤µÈ ÄÄÆÛ³ÍÆ®¸¦, ¸Þ´ºÀÇ ÁöÁ¤µÈ À§Ä¡¿¡ »ðÀÔÇÕ´Ï´Ù. |
boolean |
isBorderPainted ()
º¸´õ¸¦ ÆäÀÎÆ® ÇÒÁö ¾î¶³Áö¸¦ Á¶»çÇÕ´Ï´Ù. |
boolean |
isLightWeightPopupEnabled ()
lightWeightPopupEnabled ÇÁ·ÎÆÛƼ¸¦ ÃëµæÇÕ´Ï´Ù. |
boolean |
isPopupTrigger (MouseEvent e)
JPopupMenu
ÇöÀç ÀνºÅç µÇ°í ÀÖ´Â UI °¡ MouseEvent ¸¦ pop-up Æ®¸®°Å¶ó°í º¸´Â °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isVisible ()
pop-up menu°¡ °¡½Ã (ÇöÀç Ç¥½ÃÁß)ÀÎ °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
void |
menuSelectionChanged (boolean isIncluded)
ÀÌ ¸Þ´º¸¦ Ȱ¼ºÈ ÇÏ´ÂÁö, Ȱ¼ºÈµÇÁö ¾Ê°Ô Çϱâ À§Çؼ µµ±¸¸ðÀ½ÀÇ ¼±ÅÃÀÌ º¯°æµÇ¾úÀ» ¶§¿¡ ¸Þ¼¼Áö¸¦ º¸³À´Ï´Ù. |
void |
pack ()
ÄÁÅ×À̳ʸ¦ ·¹À̾ƿô ÇØ, ³»¿ëÀÇ Ç¥½Ã¿¡ ÃÖ¼ÒÇÑÀÇ °ø°£À» »ç¿ëÇϵµ·Ï ÇÕ´Ï´Ù. |
protected void |
paintBorder (Graphics g)
borderPainted ÇÁ·ÎÆÛƼ°¡ true ÀÎ °æ¿ì¿¡
pop-up menuÀÇ º¸´õ¸¦ ÆäÀÎÆ® ÇÕ´Ï´Ù. |
protected String |
paramString ()
ÀÌ JPopupMenu
ij¸¯ÅÍ ¶óÀΠǥÇöÀ» ¸®ÅÏÇÕ´Ï´Ù. |
protected void |
processFocusEvent (FocusEvent evt)
ÀÌ ÄÄÆÛ³ÍÆ®·Î ¹ß»ýÇÏ´Â Æ÷Ä¿½º À̺¥Æ®¸¦, µî·ÏµÇ¾î ¸ðµç FocusListener °´Ã¼¿¡ µð½ºÆÐÄ¡ ÇÏ´Â °ÍÀ¸·Î½á ó¸®ÇÕ´Ï´Ù. |
protected void |
processKeyEvent (KeyEvent evt)
Mnemonics³ª °¡¼Ó±âµîÀÇ, Ű½ºÆ®·ÎÅ©(keystroke) À̺¥Æ®¸¦ ó¸®ÇÕ´Ï´Ù. |
void |
processKeyEvent (KeyEvent e,
MenuElement [] path,
MenuSelectionManager manager)
MenuSelectionManager ·Î
ºÎÅÍ Àü¼Û µÇ´Â Ű À̺¥Æ®¸¦ ó¸®ÇÕ´Ï´Ù. |
void |
processMouseEvent (MouseEvent event,
MenuElement [] path,
MenuSelectionManager manager)
ÀÌ ¸Þ¼µå´Â MenuElement ÀÎÅÍÆäÀ̽º¿¡ ÀûÇÕÇϱâ À§Çؼ ÇÊ¿äÇÕ´Ï´Ù¸¸, ±¸ÇöµÇÁö ¾Ê½À´Ï´Ù. |
void |
remove (int pos)
ÁöÁ¤µÈ À妽º¿¡ ÀÖ´Â ÄÄÆÛ³ÍÆ®¸¦ ÀÌ pop-up menu·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù. |
void |
removeMenuKeyListener (MenuKeyListener l)
pop-up menu·ÎºÎÅÍ MenuKeyListener ¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
removePopupMenuListener (PopupMenuListener l)
PopupMenu ¸®½º³Ê¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
setBorderPainted (boolean b)
º¸´õ¸¦ ÆäÀÎÆ® ÇÒÁö ¾î¶³Áö¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
static void |
setDefaultLightWeightPopupEnabled (boolean aFlag)
lightWeightPopupEnabled ÇÁ·ÎÆÛƼÀÇ ±âº»°ªÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setInvoker (Component invoker)
pop-up menuÀÇ È£Ãâ ÄÄÆÛ³ÍÆ®, Áï, pop-up menu Ç׸ñÀÌ Ç¥½ÃµÇ´Â ÄÄÆÛ³ÍÆ®¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setLabel (String label)
pop-up menuÀÇ ¶óº§À» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setLightWeightPopupEnabled (boolean aFlag)
lightWeightPopupEnabled
±âº»°ªÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setLocation (int x,
int y)
x, y ÁÂÇ¥¸¦ »ç¿ëÇØ, pop-up menuÀÇ Á»󱸼®ÀÇ À§Ä¡¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setPopupSize (Dimension d)
Dimension °´Ã¼¸¦ »ç¿ëÇØ, pop-up À©µµ¿ìÀÇ »çÀÌÁ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setPopupSize (int width,
int height)
pop-up À©µµ¿ìÀÇ »çÀÌÁ, ÁöÁ¤µÈ³ôÀÌ ¹× ³ôÀÌ·Î ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelected (Component sel)
ÇöÀç ¼±ÅõǴ ÄÄÆÛ³ÍÆ®¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelectionModel (SingleSelectionModel model)
´ÜÀÏÀÇ ¼±ÅÃÀ» Ãë±ÞÇÏ´Â ¸ðµ¨ °´Ã¼¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setUI (PopupMenuUI ui)
ÀÌ ÄÄÆÛ³ÍÆ®¸¦ ·»´õ¸µ ÇÏ´Â L&F °´Ã¼¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setVisible (boolean b)
pop-up menuÀÇ °¡½Ã¼ºÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
show (Component invoker,
int x,
int y)
È£Ãâ ÄÄÆÛ³ÍÆ®³»ÀÇ x, y ÁÂÇ¥·Î ÁöÁ¤µÈ À§Ä¡¿¡ pop-up menu¸¦ Ç¥½ÃÇÕ´Ï´Ù. |
void |
updateUI ()
ÇöÀçÀÇ Look & Feel ·ÎºÎÅÍÀÇ °ª¿¡ UI ÇÁ·ÎÆÛƼ¸¦ ¸®¼Â ÇÕ´Ï´Ù. |
Ŭ·¡½º java.lang. Object ·ÎºÎÅÍ »ó¼ÓµÈ ¸Þ¼µå |
---|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
»ý¼ºÀÚ »ó¼¼ |
---|
public JPopupMenu()
JPopupMenu
¸¦ ±¸ÃàÇÕ´Ï´Ù.
public JPopupMenu(String label)
PopupMenu
¸¦ ±¸ÃàÇÕ´Ï´Ù.
label
- pop-up menuÀÇ Å¸ÀÌÆ²·Î¼ UI°¡ »ç¿ëÇϴ ij¸¯ÅÍ ¶óÀθ޼µåÀÇ »ó¼¼ |
---|
public static void setDefaultLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabled
ÇÁ·ÎÆÛƼÀÇ ±âº»°ªÀ» ¼³Á¤ÇÕ´Ï´Ù.
aFlag
- pop-up°¡ °æ·®ÀÇ °æ¿ì´Â true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
@see #getDefaultLightWeightPopupEnabled @see #setLightWeightPopupEnabledpublic static boolean getDefaultLightWeightPopupEnabled()
defaultLightWeightPopupEnabled
ÇÁ·ÎÆÛƼ¸¦ ÃëµæÇÕ´Ï´Ù. µðÆúÆ®¿¡¼´Â true
ÀÔ´Ï´Ù.
defaultLightWeightPopupEnabled
ÇÁ·ÎÆÛƼÀÇ °ªsetDefaultLightWeightPopupEnabled(boolean)
public PopupMenuUI getUI()
PopupMenuUI
°´Ã¼public void setUI(PopupMenuUI ui)
ui
- »õ·Î¿î PopupMenuUI
L&F °´Ã¼UIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
JComponent
³»ÀÇ updateUI
JComponent.updateUI()
public String getUIClassID()
JComponent
³»ÀÇ getUIClassID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected void processFocusEvent(FocusEvent evt)
Component
񃬣: FocusListener
°´Ã¼¿¡ µð½ºÆÐÄ¡ ÇÏ´Â °ÍÀ¸·Î½á ó¸®ÇÕ´Ï´Ù.
ÀÌ ÄÄÆÛ³ÍÆ®¿¡ ´ëÇØ¼ Æ÷Ä¿½º À̺¥Æ®°¡ »ç¿ë °¡´ÉÇÏÁö ¾ÊÀº °æ¿ì, ÀÌ ¸Þ¼µå´Â ºÒ·Á°¡ Áö ¾Ê½À´Ï´Ù. Æ÷Ä¿½º À̺¥Æ®´Â ´ÙÀ½ÀÇ ¸î°³ÀÇ °æ¿ì¿¡ »ç¿ë °¡´ÉÇÏ°Ô µË´Ï´Ù.
FocusListener
°´Ã¼°¡ addFocusListener
¿¡ ÀÇÇØ µî·ÏµÇ¾î ÀÖ´ÙenableEvents
¿¡ ÀÇÇØ Æ÷Ä¿½º À̺¥Æ®°¡ »ç¿ë °¡´ÉÇÏ°Ô µÇ¾î ÀÖ´Ù
Æ÷Ä¿½º À̺¥Æ®°¡ Component
¿¡ ´ëÇØ¼ »ç¿ë °¡´ÉÇÏ°Ô µÇ¾î ÀÖ´Â °æ¿ì, ÇöÀçÀÇ KeyboardFocusManager
¿¡
ÀÇÇØ Æ÷Ä¿½º À̺¥Æ®¸¦ µî·ÏµÈ FocusListener
°´Ã¼¿¡ µð½ºÆÐÄ¡ ÇÒ Çʿ䰡 ÀÖÀ»Áö ¾î¶³Áö°¡ ÆÇ´ÜµË´Ï´Ù. À̺¥Æ®¸¦ µð½ºÆÐÄ¡ ÇÏ´Â °æ¿ì, KeyboardFocusManager
´Â Component
dispatchEvent
¸Þ¼µå¸¦ È£ÃâÇϱ⠶§¹®¿¡
Component
processFocusEvent
¸Þ¼µå°¡ È£ÃâµË´Ï´Ù.
Æ÷Ä¿½º À̺¥Æ®°¡ Component
¿¡ ´ëÇØ¼ »ç¿ë °¡´ÉÇÏ°Ô µÇ¾î ÀÖ´Â °æ¿ì, FocusEvent
¸¦ Àμö·Î¼ Component
dispatchEvent
¸Þ¼µå¸¦ È£ÃâÇϸé, ÇöÀçÀÇ KeyboardFocusManager
¿¡ °ü°è¾øÀÌ, Component
processFocusEvent
¸Þ¼µå°¡ È£ÃâµË´Ï´Ù.
À̺¥Æ® ÆÄ¶ó¹ÌÅͰ¡ null
ÀÎ °æ¿ìÀÇ µ¿ÀÛÀº Á¤ÀǵǾî ÀÖÁö ¾Ê±â ¶§¹®¿¡ ¿¹¿Ü°¡ ¹ß»ý µË´Ï´Ù.
Component
³»ÀÇ processFocusEvent
evt
- Æ÷Ä¿½º À̺¥Æ®FocusEvent
,
FocusListener
,
KeyboardFocusManager
,
Component.addFocusListener(java.awt.event.FocusListener)
,
Component.enableEvents(long)
,
Component.dispatchEvent(java.awt.AWTEvent)
protected void processKeyEvent(KeyEvent evt)
JComponent
³»ÀÇ processKeyEvent
evt
- ó¸®µÇ´Â Ű À̺¥Æ®KeyEvent
,
KeyListener
,
KeyboardFocusManager
,
DefaultKeyboardFocusManager
,
Component.processEvent(java.awt.AWTEvent)
,
Component.dispatchEvent(java.awt.AWTEvent)
,
Component.addKeyListener(java.awt.event.KeyListener)
,
Component.enableEvents(long)
,
Component.isShowing()
public SingleSelectionModel getSelectionModel()
selectionModel
ÇÁ·ÎÆÛƼSingleSelectionModel
public void setSelectionModel(SingleSelectionModel model)
model
- »õ·Î¿î SingleSelectionModel
SingleSelectionModel
public JMenuItem add(JMenuItem menuItem)
menuItem
- Ãß°¡ÇÏ´Â JMenuitem
JMenuItem
public JMenuItem add(String s)
s
- Ãß°¡µÇ´Â ¸Þ´º Ç׸ñÀÇ Ä³¸¯ÅÍ ¶óÀÎpublic JMenuItem add(Action a)
Action
°´Ã¼¸¦ ¹èºÐÇÏ´Â ¸Þ´º Ç׸ñÀ» Ãß°¡ÇÕ´Ï´Ù.
JDK 1.3 ±× µÚ·Î´Â ÄÁÅ×À̳ʿ¡ Action
À»
Ãß°¡ÇÏ´Â °æ¿ì¿¡
ÀÌ ¸Þ¼µå¸¦ »ç¿ëÇÏ´Â °ÍÀº Ãßõ µÇÁö ¾Ê½À´Ï´Ù. ´ë½Å¿¡
setAction
À»
»ç¿ëÇØ ¾×¼ÇÀ» °¡Áö´Â ÄÁÆ®·ÑÀ» ¼³Á¤ÇØ, ±× ÄÁÆ®·ÑÀ» Á÷Á¢ Container
¿¡ Ãß°¡ÇÏ´Â °ÍÀ» ÃßõÇÕ´Ï´Ù.
a
- ¸Þ´º¿¡ Ãß°¡ÇÏ´Â Action
Action
protected JMenuItem createActionComponent(Action a)
JPopupMenu
¿¡ Ãß°¡µÈ Action
JMenuItem
¸¦ ÀÛ¼ºÇÏ´Â ÆÑÅ丮 ¸Þ¼µåÀÔ´Ï´Ù. JDK 1.3 ±× µÚ·Î´Â ÀÌ ¸Þ¼µå´Â Ãßõ µÇÁö ¾Ê½À´Ï´Ù. ´ë½Å¿¡
setAction
À»
»ç¿ëÇØ ¾×¼ÇÀ» °¡Áö´Â ÄÁÆ®·ÑÀ» ¼³Á¤ÇØ, ±× ÄÁÆ®·ÑÀ» Á÷Á¢ Container
¿¡ Ãß°¡ÇÏ´Â °ÍÀ» ÃßõÇÕ´Ï´Ù.
a
- Ãß°¡µÇ´Â ¸Þ´º Ç׸ñÀÇ Action
Action
protected PropertyChangeListener createActionChangeListener(JMenuItem b)
Action
¿¡ ´ëÇÑ º¯°æÀÌ ¹ß»ýÇßÀ» °æ¿ì¿¡ ÄÁÆ®·ÑÀ» °»½ÅÇÑ´Ù, ÀûÀýÈ÷ ¼³Á¤µÈ PropertyChangeListener
¸¦ ¸®ÅÏÇÕ´Ï´Ù. JDK 1.3 ±× µÚ·Î´Â ÀÌ ¸Þ¼µå´Â ÄÁÅ×À̳ʿ¡ Action
À»
Ãß°¡ÇÏ´Â ¸Þ¼µå·Î¼´Â Ãßõ µÇÁö ¾Ê½À´Ï´Ù. ´ë½Å¿¡
setAction
À»
»ç¿ëÇØ ¾×¼ÇÀ» °¡Áö´Â ÄÁÆ®·ÑÀ» ¼³Á¤ÇØ, ±× ÄÁÆ®·ÑÀ» Á÷Á¢ Container
¿¡ Ãß°¡ÇÏ´Â °ÍÀ» ÃßõÇÕ´Ï´Ù.
public void remove(int pos)
Container
³»ÀÇ remove
pos
- »èÁ¦µÇ´Â Ç׸ñÀÇ À§Ä¡
IllegalArgumentException
- pos
°ªÀÌ 0 º¸´Ù ÀÛÀºÁö, pos
°ªÀÌ ¸Þ´º Ç׸ñÀÇ ¼öº¸´Ù Å« °æ¿ìContainer.add(java.awt.Component)
public void setLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabled
±âº»°ªÀ» ¼³Á¤ÇÕ´Ï´Ù. µðÆúÆ®¿¡¼´Â true
ÀÔ´Ï´Ù. Look & Feel°¡ pop-up¸¦ Ç¥½ÃÇÒ ¶§, µðÆúÆ®¿¡¼´Â °æ·® (¸ðµÎ Java) pop-upÀÇ »ç¿ëÀ» ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù. °æ·® pop-up À©µµ¿ì´Â Áß·® (³×ÀÌÆ¼ºê ÇǾîÀÇ) À©µµ¿ìº¸´Ù È¿À²ÀûÀÔ´Ï´Ù¸¸, °æ·® ÄÄÆÛ³ÍÆ®¿Í Áß·® ÄÄÆÛ³ÍÆ®¸¦ GUI ¾È¿¡¼ È¥Àç½ÃÄѼ´Â ¾ÈµË´Ï´Ù. ¾îÇø®ÄÉÀ̼ÇÀ¸·Î °æ·® ÄÄÆÛ³ÍÆ®¿Í Áß·® ÄÄÆÛ³ÍÆ®°¡ È¥ÀçÇϰí ÀÖ´Â °æ¿ì´Â °æ·® pop-up¸¦ ¹«È¿·Î ÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù. ÀÌ ÇÁ·ÎÆÛƼÀÇ °ª¿¡ °ü°è¾øÀÌ, Ç×»ó Áß·® pop-up¸¦ »ç¿ëÇÏ´Â Look & Feelµµ
ÀÖ½À´Ï´Ù.
aFlag
- °æ·® pop-up¸¦ ¹«È¿·Î ÇÏ´Â °æ¿ì´Â false
isLightWeightPopupEnabled()
public boolean isLightWeightPopupEnabled()
lightWeightPopupEnabled
ÇÁ·ÎÆÛƼ¸¦ ÃëµæÇÕ´Ï´Ù.
lightWeightPopupEnabled
ÇÁ·ÎÆÛƼÀÇ °ªsetLightWeightPopupEnabled(boolean)
public String getLabel()
setLabel(java.lang.String)
public void setLabel(String label)
label
- pop-up menuÀÇ ¶óº§À» ÁöÁ¤Çϴ ij¸¯ÅÍ ¶óÀÎsetLabel(java.lang.String)
public void addSeparator()
public void insert(Action a, int index)
Action
°´Ã¼¸¦, ¸Þ´º Ç׸ñÀ¸·Î¼ ÁöÁ¤ÀÇ À§Ä¡¿¡ »ðÀÔÇÕ´Ï´Ù.
a
- »ðÀÔÇÏ´Â Action
°´Ã¼index
- Action
À»
»ðÀÔÇÏ´Â À§Ä¡. 0 Àº ¸Þ´ºÀÇ ¼±µÎ
IllegalArgumentException
- index
°ªÀÌ 0 º¸´Ù ÀÛÀº °æ¿ìAction
public void insert(Component component, int index)
component
- »ðÀÔÇÏ´Â Component
index
- ÄÄÆÛ³ÍÆ®¸¦ »ðÀÔÇÏ´Â À§Ä¡. 0 Àº ¸Þ´ºÀÇ ¼±µÎ
IllegalArgumentException
- index
°ªÀÌ 0 º¸´Ù ÀÛÀº °æ¿ìpublic void addPopupMenuListener(PopupMenuListener l)
PopupMenu
¸®½º³Ê¸¦ Ãß°¡ÇÕ´Ï´Ù.
l
- Ãß°¡ÇÏ´Â PopupMenuListener
public void removePopupMenuListener(PopupMenuListener l)
PopupMenu
¸®½º³Ê¸¦ »èÁ¦ÇÕ´Ï´Ù.
l
- »èÁ¦ÇÏ´Â PopupMenuListener
public PopupMenuListener [] getPopupMenuListeners()
PopupMenuListener
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù.
PopupMenuListener
. Ãß°¡µÈ ¸®½º³Ê°¡ ¾ø´Â °æ¿ì´Â ºñ¾îÀÖ´Â ¹è¿public void addMenuKeyListener(MenuKeyListener l)
MenuKeyListener
¸¦ Ãß°¡ÇÕ´Ï´Ù.
l
- Ãß°¡µÇ´Â MenuKeyListener
public void removeMenuKeyListener(MenuKeyListener l)
MenuKeyListener
¸¦ »èÁ¦ÇÕ´Ï´Ù.
l
- »èÁ¦µÇ´Â MenuKeyListener
public MenuKeyListener [] getMenuKeyListeners()
MenuKeyListener
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù.
MenuKeyListener
. Ãß°¡µÈ ¸®½º³Ê°¡ ¾ø´Â °æ¿ì´Â ºñ¾îÀÖ´Â ¹è¿protected void firePopupMenuWillBecomeVisible()
PopupMenuListener
¿¡
pop-up menu°¡ °¡½Ã°¡ µÇ´Â °ÍÀ» ÅëÁöÇÕ´Ï´Ù.
protected void firePopupMenuWillBecomeInvisible()
PopupMenuListener
¿¡
pop-up menu°¡ ºÒ°¡½Ã°¡ µÇ´Â °ÍÀ» ÅëÁöÇÕ´Ï´Ù.
protected void firePopupMenuCanceled()
PopupMenuListener
¿¡
pop-up menu°¡ »èÁ¦µÈ °ÍÀ» ÅëÁöÇÕ´Ï´Ù.
public void pack()
public void setVisible(boolean b)
JComponent
³»ÀÇ setVisible
b
- pop-up¸¦ °¡½Ã·Î ÇÏ´Â °æ¿ì´Â true, ¼û±â´Â °æ¿ì´Â falseComponent.isVisible()
public boolean isVisible()
Component
³»ÀÇ isVisible
true
, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false
Component.setVisible(boolean)
public void setLocation(int x, int y)
Component
³»ÀÇ setLocation
x
- ȸéÀÇ ÁÂÇ¥ °ø°£¿¡¼ÀÇ pop-up menuÀÇ »õ·Î¿î À§Ä¡ÀÇ x ÁÂÇ¥y
- ȸéÀÇ ÁÂÇ¥ °ø°£¿¡¼ÀÇ pop-up menuÀÇ »õ·Î¿î À§Ä¡ÀÇ y ÁÂÇ¥Component.getLocation()
,
Component.setBounds(int, int, int, int)
public Component getInvoker()
Component
public void setInvoker(Component invoker)
invoker
- pop-up menu°¡ Ç¥½ÃµÇ´Â Component
public void show(Component invoker, int x, int y)
invoker
- pop-up menu°¡ Ç¥½ÃµÇ´Â ÄÄÆÛ³ÍÆ®x
- pop-up menu¸¦ Ç¥½ÃÇϴ ȣÃâ ÄÄÆÛ³ÍÆ®ÀÇ x ÁÂÇ¥y
- pop-up menu¸¦ Ç¥½ÃÇϴ ȣÃâ ÄÄÆÛ³ÍÆ®ÀÇ y ÁÂÇ¥@Deprecated public Component getComponentAtIndex(int i)
getComponent(int i)
·Î
¿Å°ÜÁ³½À´Ï´Ù.
i
- ÄÄÆÛ³ÍÆ®ÀÇ À妽º. 0 ÀÌ ¼±µÎ
Component
public int getComponentIndex(Component c)
c
- °Ë»ö ´ë»óÀÇ Component
public void setPopupSize(Dimension d)
Dimension
°´Ã¼¸¦ »ç¿ëÇØ, pop-up À©µµ¿ìÀÇ »çÀÌÁ ¼³Á¤ÇÕ´Ï´Ù. À̰ÍÀº, setPreferredSize(d)
¿Í
µ¿µîÇÕ´Ï´Ù.
d
- ÀÌ ÄÄÆÛ³ÍÆ®ÀÇ »õ·Î¿î »çÀÌÁ ÁöÁ¤ÇÏ´Â Dimension
public void setPopupSize(int width, int height)
setPreferredSize(new Dimension(width, height))
¿¡ »ó´çÇÕ´Ï´Ù.
width
- Popup
»õ·Î¿î³ôÀÌ (Çȼ¿ ´ÜÀ§)height
- Popup
»õ·Î¿î ³ôÀÌ (Çȼ¿ ´ÜÀ§)public void setSelected(Component sel)
sel
- ¼±ÅÃÇÏ´Â Component
public boolean isBorderPainted()
setBorderPainted(boolean)
public void setBorderPainted(boolean b)
b
- trueÀÎ °æ¿ì´Â º¸´õ°¡ ÆäÀÎÆ® µÇ´ÂisBorderPainted()
protected void paintBorder(Graphics g)
borderPainted
ÇÁ·ÎÆÛƼ°¡ true
ÀÎ °æ¿ì¿¡
pop-up menuÀÇ º¸´õ¸¦ ÆäÀÎÆ® ÇÕ´Ï´Ù.
JComponent
³»ÀÇ paintBorder
g
- Graphics
°´Ã¼JComponent.paint(java.awt.Graphics)
,
JComponent.setBorder(javax.swing.border.Border)
public Insets getMargin()
Insets
°´Ã¼protected String paramString()
JPopupMenu
ij¸¯ÅÍ ¶óÀΠǥÇöÀ» ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ¸Þ¼µå´Â µð¹ö±× Àü¿ëÀ̸ç, ¸®ÅϵÈ
ij¸¯ÅÍ ¶óÀÎÀÇ ³»¿ë ¹× Çü½ÄÀº ±¸Çö¿¡ µû¶ó¼ ´Ù¸¨´Ï´Ù. ¸®ÅϵÈ
ij¸¯ÅÍ ¶óÀÎÀº ºñ¾îÀÖ´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù¸¸, null
·Î´Â µÇÁö ¾Ê½À´Ï´Ù.
JComponent
³»ÀÇ paramString
JPopupMenu
ij¸¯ÅÍ ¶óÀΠǥÇöpublic AccessibleContext getAccessibleContext()
Accessible
³»ÀÇ getAccessibleContext
JComponent
³»ÀÇ getAccessibleContext
public void processMouseEvent(MouseEvent event, MenuElement [] path, MenuSelectionManager manager)
MenuElement
ÀÎÅÍÆäÀ̽º¿¡ ÀûÇÕÇϱâ À§Çؼ ÇÊ¿äÇÕ´Ï´Ù¸¸, ±¸ÇöµÇÁö ¾Ê½À´Ï´Ù.
MenuElement
³»ÀÇ processMouseEvent
MenuElement.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)
public void processKeyEvent(KeyEvent e, MenuElement [] path, MenuSelectionManager manager)
MenuSelectionManager
·Î
ºÎÅÍ Àü¼Û µÇ´Â Ű À̺¥Æ®¸¦ ó¸®ÇÕ´Ï´Ù. Çʿ信 µû¶ó¼ MenuSelectionManager
API¸¦ »ç¿ëÇØ, ¸Þ´º ¼±ÅÃÀ» º¯°æÇÕ´Ï´Ù.
ÁÖ: À̺¥Æ®¸¦ ¼ºê ÄÄÆÛ³ÍÆ®¿¡ Àü¼Û ÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù. MenuSelectionManager
°¡ ÀÚµ¿ÀûÀ¸·Î ½ÇÇàÇÕ´Ï´Ù.
MenuElement
³»ÀÇ processKeyEvent
e
- KeyEvent
path
- MenuElement
ÆÐ½º ¹è¿manager
- MenuSelectionManager
public void menuSelectionChanged(boolean isIncluded)
javax.swing.MenuElement
ÀÎÅÍÆäÀ̽º¸¦ ±¸ÇöÇÕ´Ï´Ù. MenuElement.menuSelectionChanged
¸¦ ¿À¹ö¶óÀ̵å(override)ÀÇÇØ ÁÖ¼¼¿ä.
MenuElement
³»ÀÇ menuSelectionChanged
isIncluded
- ÀÌ ¸Þ´º°¡ Ȱ¼ºÈµÈ °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falseMenuElement.menuSelectionChanged(boolean)
public MenuElement [] getSubElements()
MenuElement
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. JMenuElement
ÀÎÅÍÆäÀ̽º¿¡ ÀûÇÕÇÏ´Â Ç׸ñ¸¸À» ¸®ÅÏÇÕ´Ï´Ù. pop-up menu°¡ null
ÀÎ °æ¿ì´Â ºñ¾îÀÖ´Â ¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ¸Þ¼µå´Â MenuElement
ÀÎÅÍÆäÀ̽º¿¡ ÀûÇÕÇϱâ À§Çؼ ÇÊ¿äÇÕ´Ï´Ù.
MenuElement
³»ÀÇ getSubElements
MenuElement
°´Ã¼ÀÇ ¹è¿MenuElement.getSubElements()
public Component getComponent()
JPopupMenu
ÄÄÆÛ³ÍÆ®¸¦ ¸®ÅÏÇÕ´Ï´Ù.
MenuElement
³»ÀÇ getComponent
JPopupMenu
°´Ã¼MenuElement.getComponent()
public boolean isPopupTrigger(MouseEvent e)
JPopupMenu
ÇöÀç ÀνºÅç µÇ°í ÀÖ´Â UI °¡ MouseEvent
¸¦ pop-up Æ®¸®°Å¶ó°í º¸´Â °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.