JavaTM Platform
Standard Ed. 6

javax.swing
클래스 JPopupMenu

java.lang.Object 
  상위를 확장 java.awt.Component 
      상위를 확장 java.awt.Container 
          상위를 확장 javax.swing.JComponent 
              상위를 확장 javax.swing.JPopupMenu
모든 구현된 인터페이스:
ImageObserver , MenuContainer , Serializable , Accessible , MenuElement
직계의 기존의 서브 클래스:
BasicComboPopup


public class JPopupMenu
extends JComponent
implements Accessible , MenuElement

pop-up menu의 구현입니다. pop-up menu는 작은 윈도우로, 복수의 선택사항 (메뉴 커멘드)을 표시합니다. JPopupMenu 는, 도구모음상의 항목이 선택되었을 때에 표시하는 메뉴에 사용합니다. 또, 선택한 메뉴 항목에 따라서는 표시되는 일도 있는, 프르라이트메뉴에도 사용됩니다. 혹은, 메뉴를 표시하는 것 외의 장소 (도구모음 이외의 장소)에서도,JPopupMenu 를 사용할 수 있습니다. 예를 들어, 특정의 장소에서 오른쪽 클릭이 발생했을 경우의 pop-up menu 표시 (쇼트 컷 메뉴) 등입니다.  

pop-up menu의 사용 방법의 상세와 예에 대해서는, 「The Java Tutorial」의「How to Use Menus」를 참조해 주세요.  

경고: Swing 는 thread에 대해서 안전하지는 않습니다. 자세한 것은,「Swing's Threading Policy」를 참조해 주세요.  

경고: 이 클래스의 직렬화 된 객체는, 향후의 Swing 릴리스와 호환은 아니게 될 예정입니다. 현재의 직렬화의 지원는, 단기간의 운용이나, 같은 버젼의 Swing 를 실행하는 어플리케이션간의 RMI 에 적절하고 있습니다. JDK Version 1.4 이후, 모든 JavaBeans 의 장기간의 운용 지원는,java.beans 패키지에 추가되고 있습니다. 자세한 것은,XMLEncoder 를 참조해 주세요.


상자의 클래스의 개요
protected  class JPopupMenu.AccessibleJPopupMenu
          이 클래스는 JPopupMenu 클래스용의 접근성? 지원를 구현하고 있습니다.
static class JPopupMenu.Separator
          pop-up menu 고유의 separator입니다.
 
클래스 javax.swing. JComponent 로부터 상속된 상자의 클래스/인터페이스
JComponent.AccessibleJComponent
 
클래스 java.awt. Container 로부터 상속된 상자의 클래스/인터페이스
Container.AccessibleAWTContainer
 
클래스 java.awt. Component 로부터 상속된 상자의 클래스/인터페이스
Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , 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 에 추가된 ActionJMenuItem 를 작성하는 팩토리 메소드입니다.
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)
          추천 되고 있지 않습니다.  Container.getComponent(int) 로 옮겨놓을 수 있었습니다.
 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 ()
          이 컴퍼넌트를 draw 하는 Look & Feel (L&F) 객체를 돌려줍니다.
 String getUIClassID ()
          이 컴퍼넌트를 draw 하는 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 의 캐릭터 라인 표현을 돌려줍니다.
protected  void processFocusEvent (FocusEvent  evt)
          이 컴퍼넌트로 발생하는 포커스 이벤트를, 등록되어 모든 FocusListener 객체에 발송 하는 것으로써 처리합니다.
protected  void processKeyEvent (KeyEvent  evt)
          니마닉(mnemonic)나 가속기등의, 키스트로크(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 객체를 사용해, Popup 윈도우의 사이즈를 설정합니다.
 void setPopupSize (int width, int height)
          pop-up 윈도우의 사이즈를, 지정된 폭 및 높이로 설정합니다.
 void setSelected (Component  sel)
          현재 선택되는 컴퍼넌트를 설정합니다.
 void setSelectionModel (SingleSelectionModel  model)
          단일의 선택을 취급하는 모델 객체를 설정합니다.
 void setUI (PopupMenuUI  ui)
          이 컴퍼넌트를 draw 하는 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 프로퍼티을 리셋 합니다.
 
클래스 javax.swing. JComponent 로부터 상속된 메소드
addAncestorListener , addNotify , addVetoableChangeListener , computeVisibleRect , contains , createToolTip , disable , enable , firePropertyChange , firePropertyChange , firePropertyChange , fireVetoableChange , getActionForKeyStroke , getActionMap , getAlignmentX , getAlignmentY , getAncestorListeners , getAutoscrolls , getBaseline , getBaselineResizeBehavior , getBorder , getBounds , getClientProperty , getComponentGraphics , getComponentPopupMenu , getConditionForKeyStroke , getDebugGraphicsOptions , getDefaultLocale , getFontMetrics , getGraphics , getHeight , getInheritsPopupMenu , getInputMap , getInputMap , getInputVerifier , getInsets , getInsets , getListeners , getLocation , getMaximumSize , getMinimumSize , getNextFocusableComponent , getPopupLocation , getPreferredSize , getRegisteredKeyStrokes , getRootPane , getSize , getToolTipLocation , getToolTipText , getToolTipText , getTopLevelAncestor , getTransferHandler , getVerifyInputWhenFocusTarget , getVetoableChangeListeners , getVisibleRect , getWidth , getX , getY , grabFocus , isDoubleBuffered , isLightweightComponent , isManagingFocus , isOpaque , isOptimizedDrawingEnabled , isPaintingForPrint , isPaintingTile , isRequestFocusEnabled , isValidateRoot , paint , paintChildren , paintComponent , paintImmediately , paintImmediately , print , printAll , printBorder , printChildren , printComponent , processComponentKeyEvent , processKeyBinding , processMouseEvent , processMouseMotionEvent , putClientProperty , registerKeyboardAction , registerKeyboardAction , removeAncestorListener , removeNotify , removeVetoableChangeListener , repaint , repaint , requestDefaultFocus , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , resetKeyboardActions , reshape , revalidate , scrollRectToVisible , setActionMap , setAlignmentX , setAlignmentY , setAutoscrolls , setBackground , setBorder , setComponentPopupMenu , setDebugGraphicsOptions , setDefaultLocale , setDoubleBuffered , setEnabled , setFocusTraversalKeys , setFont , setForeground , setInheritsPopupMenu , setInputMap , setInputVerifier , setMaximumSize , setMinimumSize , setNextFocusableComponent , setOpaque , setPreferredSize , setRequestFocusEnabled , setToolTipText , setTransferHandler , setUI , setVerifyInputWhenFocusTarget , unregisterKeyboardAction , update
 
클래스 java.awt. Container 로부터 상속된 메소드
add , add , add , add , add , addContainerListener , addImpl , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , countComponents , deliverEvent , doLayout , findComponentAt , findComponentAt , getComponent , getComponentAt , getComponentAt , getComponentCount , getComponents , getComponentZOrder , getContainerListeners , getFocusTraversalKeys , getFocusTraversalPolicy , getLayout , getMousePosition , insets , invalidate , isAncestorOf , isFocusCycleRoot , isFocusCycleRoot , isFocusTraversalPolicyProvider , isFocusTraversalPolicySet , layout , list , list , locate , minimumSize , paintComponents , preferredSize , printComponents , processContainerEvent , processEvent , remove , removeAll , removeContainerListener , setComponentZOrder , setFocusCycleRoot , setFocusTraversalPolicy , setFocusTraversalPolicyProvider , setLayout , transferFocusBackward , transferFocusDownCycle , validate , validateTree
 
클래스 java.awt. Component 로부터 상속된 메소드
action , add , addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , addInputMethodListener , addKeyListener , addMouseListener , addMouseMotionListener , addMouseWheelListener , bounds , checkImage , checkImage , coalesceEvents , contains , createImage , createImage , createVolatileImage , createVolatileImage , disableEvents , dispatchEvent , enable , enableEvents , enableInputMethods , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getBackground , getBounds , getColorModel , getComponentListeners , getComponentOrientation , getCursor , getDropTarget , getFocusCycleRootAncestor , getFocusListeners , getFocusTraversalKeysEnabled , getFont , getForeground , getGraphicsConfiguration , getHierarchyBoundsListeners , getHierarchyListeners , getIgnoreRepaint , getInputContext , getInputMethodListeners , getInputMethodRequests , getKeyListeners , getLocale , getLocation , getLocationOnScreen , getMouseListeners , getMouseMotionListeners , getMousePosition , getMouseWheelListeners , getName , getParent , getPeer , getPropertyChangeListeners , getPropertyChangeListeners , getSize , getToolkit , getTreeLock , gotFocus , handleEvent , hasFocus , hide , imageUpdate , inside , isBackgroundSet , isCursorSet , isDisplayable , isEnabled , isFocusable , isFocusOwner , isFocusTraversable , isFontSet , isForegroundSet , isLightweight , isMaximumSizeSet , isMinimumSizeSet , isPreferredSizeSet , isShowing , isValid , keyDown , keyUp , list , list , list , location , lostFocus , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paintAll , postEvent , prepareImage , prepareImage , processComponentEvent , processHierarchyBoundsEvent , processHierarchyEvent , processInputMethodEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , resize , resize , setBounds , setBounds , setComponentOrientation , setCursor , setDropTarget , setFocusable , setFocusTraversalKeysEnabled , setIgnoreRepaint , setLocale , setLocation , setName , setSize , setSize , show , show , size , toString , transferFocus , transferFocusUpCycle
 
클래스 java.lang. Object 로부터 상속된 메소드
clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait
 

생성자 의 상세

JPopupMenu

public JPopupMenu()
호출 컴퍼넌트의 정의없이 JPopupMenu 를 구축합니다.


JPopupMenu

public JPopupMenu(String  label)
지정된 타이틀의 PopupMenu 를 구축합니다.

파라미터:
label - pop-up menu의 타이틀로서 UI 를 사용할 수 있는 캐릭터 라인
메소드의 상세

setDefaultLightWeightPopupEnabled

public static void setDefaultLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabled 프로퍼티의 디폴트 값를 설정합니다.

파라미터:
aFlag - pop-up가 경량의 경우는 true, 그렇지 않은 경우는 false
관련 항목:
getDefaultLightWeightPopupEnabled() , setLightWeightPopupEnabled(boolean)

getDefaultLightWeightPopupEnabled

public static boolean getDefaultLightWeightPopupEnabled()
defaultLightWeightPopupEnabled 프로퍼티을 가져옵니다. 디폴트에서는 true 입니다.

반환값:
defaultLightWeightPopupEnabled 프로퍼티의 값
관련 항목:
setDefaultLightWeightPopupEnabled(boolean)

getUI

public PopupMenuUI  getUI()
이 컴퍼넌트를 draw 하는 Look & Feel (L&F) 객체를 돌려줍니다.

반환값:
컴퍼넌트를 draw 하는 PopupMenuUI 객체

setUI

public void setUI(PopupMenuUI  ui)
이 컴퍼넌트를 draw 하는 L&F 객체를 설정합니다.

파라미터:
ui - 신규 PopupMenuUI L&F 객체
관련 항목:
UIDefaults.getUI(javax.swing.JComponent)

updateUI

public void updateUI()
현재의 Look & Feel 로부터의 값에 UI 프로퍼티을 리셋 합니다.

오버라이드(override):
클래스 JComponent 내의 updateUI
관련 항목:
JComponent.updateUI()

getUIClassID

public String  getUIClassID()
이 컴퍼넌트를 draw 하는 L&F 클래스의 이름을 돌려줍니다.

오버라이드(override):
클래스 JComponent 내의 getUIClassID
반환값:
캐릭터 라인 「PopupMenuUI」
관련 항목:
JComponent.getUIClassID() , UIDefaults.getUI(javax.swing.JComponent)

processFocusEvent

protected void processFocusEvent(FocusEvent  evt)
클래스 Component 의 기술:
이 컴퍼넌트로 발생하는 포커스 이벤트를, 등록되어 모든 FocusListener 객체에 발송 하는 것으로써 처리합니다.  

이 컴퍼넌트에 대해서 포커스 이벤트가 사용 가능하지 않은 경우, 이 메소드는 불려 가지 않습니다. 포커스 이벤트는, 다음의 몇개의 경우에 사용 가능하게 됩니다.  

포커스 이벤트가 Component 에 대해서 사용 가능하게 되어 있는 경우, 현재의 KeyboardFocusManager 에 의해, 포커스 이벤트를 등록된 FocusListener 객체에 발송 할 필요가 있을지 어떨지가 판단됩니다. 이벤트를 발송 하는 경우,KeyboardFocusManagerComponentdispatchEvent 메소드를 호출하기 (위해)때문에,ComponentprocessFocusEvent 메소드가 불려 갑니다.  

포커스 이벤트가 Component 에 대해서 사용 가능하게 되어 있는 경우,FocusEvent 를 인수로서 ComponentdispatchEvent 메소드를 호출하면(자), 현재의 KeyboardFocusManager 에 관계없이,ComponentprocessFocusEvent 메소드가 불려 갑니다.  

이벤트 파라미터가 null 의 경우의 동작은 정의되어 있지 않기 때문에 예외가 throw 됩니다.

오버라이드(override):
클래스 Component 내의 processFocusEvent
파라미터:
evt - 포커스 이벤트
관련 항목:
FocusEvent , FocusListener , KeyboardFocusManager , Component.addFocusListener(java.awt.event.FocusListener) , Component.enableEvents(long) , Component.dispatchEvent(java.awt.AWTEvent)

processKeyEvent

protected void processKeyEvent(KeyEvent  evt)
니마닉(mnemonic)나 가속기등의, 키스트로크(keystroke) 이벤트를 처리합니다.

오버라이드(override):
클래스 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()

getSelectionModel

public SingleSelectionModel  getSelectionModel()
단일의 선택을 취급하는 모델 객체를 돌려줍니다.

반환값:
selectionModel 프로퍼티
관련 항목:
SingleSelectionModel

setSelectionModel

public void setSelectionModel(SingleSelectionModel  model)
단일의 선택을 취급하는 모델 객체를 설정합니다.

파라미터:
model - 신규 SingleSelectionModel
관련 항목:
SingleSelectionModel

add

public JMenuItem  add(JMenuItem  menuItem)
지정된 메뉴 항목을 메뉴의 말미에 추가합니다.

파라미터:
menuItem - 추가하는 JMenuitem
반환값:
추가된 JMenuItem

add

public JMenuItem  add(String  s)
지정된 텍스트를 가지는 새로운 메뉴 항목을 작성해, 이 메뉴의 말미에 추가합니다.

파라미터:
s - 추가되는 메뉴 항목의 캐릭터 라인

add

public JMenuItem  add(Action  a)
메뉴의 말미에, 지정된 Action 객체를 배분하는 메뉴 항목을 추가합니다.

파라미터:
a - 메뉴에 추가하는 Action
반환값:
새로운 메뉴 항목
관련 항목:
Action

createActionComponent

protected JMenuItem  createActionComponent(Action  a)
JPopupMenu 에 추가된 ActionJMenuItem 를 작성하는 팩토리 메소드입니다.

파라미터:
a - 추가되는 메뉴 항목의 Action
반환값:
새로운 메뉴 항목
도입된 버젼:
1.3
관련 항목:
Action

createActionChangeListener

protected PropertyChangeListener  createActionChangeListener(JMenuItem  b)
Action 에 대한 변경이 발생했을 경우에 컨트롤을 갱신한다, 적절히 설정된 PropertyChangeListener 를 돌려줍니다.


remove

public void remove(int pos)
지정된 인덱스에 있는 컴퍼넌트를 이 pop-up menu로부터 삭제합니다.

오버라이드(override):
클래스 Container 내의 remove
파라미터:
pos - 삭제되는 항목의 위치
예외:
IllegalArgumentException - pos 의 값이 0 보다 작은지,pos 의 값이 메뉴 항목의 수보다 큰 경우
관련 항목:
Container.add(java.awt.Component) , Container.validate() , Container.getComponentCount()

setLightWeightPopupEnabled

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()

isLightWeightPopupEnabled

public boolean isLightWeightPopupEnabled()
lightWeightPopupEnabled 프로퍼티을 가져옵니다.

반환값:
lightWeightPopupEnabled 프로퍼티의 값
관련 항목:
setLightWeightPopupEnabled(boolean)

getLabel

public String  getLabel()
pop-up menu의 라벨을 돌려줍니다.

반환값:
pop-up menu의 라벨이 포함되고 있는 캐릭터 라인
관련 항목:
setLabel(java.lang.String)

setLabel

public void setLabel(String  label)
pop-up menu의 라벨을 설정합니다. Look & Feel 의 구현 마다, 라벨을 표시할지 어떨지를 선택해도 괜찮습니다.

파라미터:
label - pop-up menu의 라벨을 지정하는 캐릭터 라인
관련 항목:
setLabel(java.lang.String)

addSeparator

public void addSeparator()
메뉴의 말미에 새로운 separator를 추가합니다.


insert

public void insert(Action  a,
                   int index)
지정된 Action 객체를, 메뉴 항목으로서 지정의 위치에 삽입합니다.

파라미터:
a - 삽입하는 Action 객체
index - Action 를 삽입하는 위치. 0 은 메뉴의 선두
예외:
IllegalArgumentException - index 의 값이 0 보다 작은 경우
관련 항목:
Action

insert

public void insert(Component  component,
                   int index)
지정된 컴퍼넌트를, 메뉴의 지정된 위치에 삽입합니다.

파라미터:
component - 삽입하는 Component
index - 컴퍼넌트를 삽입하는 위치. 0 은 메뉴의 선두
예외:
IllegalArgumentException - index 의 값이 0 보다 작은 경우

addPopupMenuListener

public void addPopupMenuListener(PopupMenuListener  l)
PopupMenu 청취자를 추가합니다.

파라미터:
l - 추가하는 PopupMenuListener

removePopupMenuListener

public void removePopupMenuListener(PopupMenuListener  l)
PopupMenu 청취자를 삭제합니다.

파라미터:
l - 삭제하는 PopupMenuListener

getPopupMenuListeners

public PopupMenuListener [] getPopupMenuListeners()
이 JMenuItem 에 addPopupMenuListener()로 추가된 모든 PopupMenuListener 의 배열을 돌려줍니다.

반환값:
추가된 모든 PopupMenuListener, 청취자가 추가되어 있지 않은 경우는 빈 상태(empty)의 배열
도입된 버젼:
1.4

addMenuKeyListener

public void addMenuKeyListener(MenuKeyListener  l)
pop-up menu에 MenuKeyListener 를 추가합니다.

파라미터:
l - 추가되는 MenuKeyListener
도입된 버젼:
1.5

removeMenuKeyListener

public void removeMenuKeyListener(MenuKeyListener  l)
pop-up menu로부터 MenuKeyListener 를 삭제합니다.

파라미터:
l - 삭제되는 MenuKeyListener
도입된 버젼:
1.5

getMenuKeyListeners

public MenuKeyListener [] getMenuKeyListeners()
이 JPopupMenu 에 addMenuKeyListener()로 추가된 모든 MenuKeyListener 의 배열을 돌려줍니다.

반환값:
추가된 모든 MenuKeyListener, 청취자가 추가되어 있지 않은 경우는 빈 상태(empty)의 배열
도입된 버젼:
1.5

firePopupMenuWillBecomeVisible

protected void firePopupMenuWillBecomeVisible()
PopupMenuListener 에, pop-up menu가 가시가 되는 것을 통지합니다.


firePopupMenuWillBecomeInvisible

protected void firePopupMenuWillBecomeInvisible()
PopupMenuListener 에, pop-up menu가 불가시가 되는 것을 통지합니다.


firePopupMenuCanceled

protected void firePopupMenuCanceled()
PopupMenuListener 에, pop-up menu가 삭제된 것을 통지합니다.


pack

public void pack()
컨테이너를 레이아웃 해, 내용의 표시에 최소한의 공간을 사용하도록(듯이) 합니다.


setVisible

public void setVisible(boolean b)
pop-up menu의 가시성을 설정합니다.

오버라이드(override):
클래스 JComponent 내의 setVisible
파라미터:
b - pop-up를 가시로 하는 경우는 true, 숨기는 경우는 false
관련 항목:
Component.isVisible()

isVisible

public boolean isVisible()
pop-up menu가 가시 (현재 표시중)인 경우에 true 를 돌려줍니다.

오버라이드(override):
클래스 Component 내의 isVisible
반환값:
컴퍼넌트가 가시의 경우는 true, 그렇지 않은 경우는 false
관련 항목:
Component.setVisible(boolean)

setLocation

public void setLocation(int x,
                        int y)
x, y 좌표를 사용해, pop-up menu의 좌상구석의 위치를 설정합니다.

오버라이드(override):
클래스 Component 내의 setLocation
파라미터:
x - 화면의 좌표 공간에서의 pop-up menu의 새로운 위치의 x 좌표
y - 화면의 좌표 공간에서의 pop-up menu의 새로운 위치의 y 좌표
관련 항목:
Component.getLocation() , Component.setBounds(int, int, int, int)

getInvoker

public Component  getInvoker()
pop-up menu의 호출 컴퍼넌트를 돌려줍니다.

반환값:
pop-up menu가 표시되는 Component

setInvoker

public void setInvoker(Component  invoker)
pop-up menu의 호출 컴퍼넌트, 즉, pop-up menu 항목이 표시되는 컴퍼넌트를 설정합니다.

파라미터:
invoker - pop-up menu가 표시되는 Component

show

public void show(Component  invoker,
                 int x,
                 int y)
호출 컴퍼넌트내의 x, y 좌표로 지정된 위치에, pop-up menu를 표시합니다.

파라미터:
invoker - pop-up menu가 표시되는 컴퍼넌트
x - pop-up menu를 표시한다 호출 컴퍼넌트의 좌표 공간에서의 x 좌표
y - pop-up menu를 표시한다 호출 컴퍼넌트의 좌표 공간에서의 y 좌표

getComponentAtIndex

@Deprecated 
public Component  getComponentAtIndex(int i)
추천 되고 있지 않습니다.  Container.getComponent(int) 로 옮겨놓을 수 있었습니다.

지정된 인덱스의 요소를 돌려줍니다.

파라미터:
i - 컴퍼넌트의 인덱스. 0 이 선두
반환값:
지정된 인덱스의 Component

getComponentIndex

public int getComponentIndex(Component  c)
지정된 컴퍼넌트의 인덱스를 돌려줍니다.

파라미터:
c - 검색 대상의 Component
반환값:
컴퍼넌트의 인덱스. 0 이 선두. 컴퍼넌트가 없으면 -1

setPopupSize

public void setPopupSize(Dimension  d)
Dimension 객체를 사용해, Popup 윈도우의 사이즈를 설정합니다. 이것은,setPreferredSize(d) 와 동등합니다.

파라미터:
d - 이 컴퍼넌트의 신규 사이즈를 지정하는 Dimension

setPopupSize

public void setPopupSize(int width,
                         int height)
pop-up 윈도우의 사이즈를, 지정된 폭 및 높이로 설정합니다. 이것은 setPreferredSize(new Dimension(width, height)) 에 상당합니다.

파라미터:
width - Popup 의 새로운 폭 (픽셀 단위)
height - Popup 의 새로운 높이 (픽셀 단위)

setSelected

public void setSelected(Component  sel)
현재 선택되는 컴퍼넌트를 설정합니다. 결과적으로, 선택 모델이 변경됩니다.

파라미터:
sel - 선택하는 Component

isBorderPainted

public boolean isBorderPainted()
경계를 페인트 할지 어떨지를 조사합니다.

반환값:
경계를 페인트 하는 경우는 true, 그렇지 않은 경우는 false
관련 항목:
setBorderPainted(boolean)

setBorderPainted

public void setBorderPainted(boolean b)
경계를 페인트 할지 어떨지를 설정합니다.

파라미터:
b - true 의 경우는 경계가 페인트 되는
관련 항목:
isBorderPainted()

paintBorder

protected void paintBorder(Graphics  g)
borderPainted 프로퍼티이 true 인 경우에, pop-up menu의 경계를 그립니다.

오버라이드(override):
클래스 JComponent 내의 paintBorder
파라미터:
g - Graphics 객체
관련 항목:
JComponent.paint(java.awt.Graphics) , JComponent.setBorder(javax.swing.border.Border)

getMargin

public Insets  getMargin()
pop-up menu의 경계와 내용의 사이에 있는 마진의 값을 돌려줍니다 (픽셀 단위).

반환값:
마진의 값을 보관 유지하는 Insets 객체

paramString

protected String  paramString()
JPopupMenu 의 캐릭터 라인 표현을 돌려줍니다. 이 메소드는 디버그 전용이며, 반환되는 캐릭터 라인의 내용 및 형식은 구현에 따라서 다릅니다. 반환되는 캐릭터 라인은 빈 상태(empty)의 경우가 있습니다만,null 로는 되지 않습니다.

오버라이드(override):
클래스 JComponent 내의 paramString
반환값:
JPopupMenu 의 캐릭터 라인 표현

getAccessibleContext

public AccessibleContext  getAccessibleContext()
이 JPopupMenu 에 관련한 AccessibleContext 를 돌려줍니다. JPopupMenu 의 경우, AccessibleContext 는 AccessibleJPopupMenu 의 형식을 취합니다. 필요에 따라서 신규의 AccessibleJPopupMenu 인스턴스가 작성됩니다.

정의:
인터페이스 Accessible 내의 getAccessibleContext
오버라이드(override):
클래스 JComponent 내의 getAccessibleContext
반환값:
이 JPopupMenu 의 AccessibleContext 로서 기능한다 AccessibleJPopupMenu

processMouseEvent

public void processMouseEvent(MouseEvent  event,
                              MenuElement [] path,
                              MenuSelectionManager  manager)
이 메소드는 MenuElement 인터페이스에 적합하기 위해서 필요합니다만, 구현되고 있지 않습니다.

정의:
인터페이스 MenuElement 내의 processMouseEvent
관련 항목:
MenuElement.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)

processKeyEvent

public void processKeyEvent(KeyEvent  e,
                            MenuElement [] path,
                            MenuSelectionManager  manager)
MenuSelectionManager 로부터 전송 되는 키 이벤트를 처리합니다. 필요에 따라서 MenuSelectionManager 의 API 를 사용해, 메뉴 선택을 변경합니다.  

주:주: 이벤트를 서브 컴퍼넌트에 전송 할 필요는 없습니다. MenuSelectionManager 가 자동적으로 실시합니다.

정의:
인터페이스 MenuElement 내의 processKeyEvent
파라미터:
e - KeyEvent
path - MenuElement 패스 배열
manager - MenuSelectionManager

menuSelectionChanged

public void menuSelectionChanged(boolean isIncluded)
이 메뉴를 액티브하게 하는지, 액티브하지 않게 하기 위해서 도구모음의 선택이 변경되었을 때에, 메세지를 보냅니다. 이 메소드는 javax.swing.MenuElement 인터페이스를 구현합니다. MenuElement.menuSelectionChanged 를 오버라이드(override) 해 주세요.

정의:
인터페이스 MenuElement 내의 menuSelectionChanged
파라미터:
isIncluded - 이 메뉴가 액티브한 경우는 true, 그렇지 않은 경우는 false
관련 항목:
MenuElement.menuSelectionChanged(boolean)

getSubElements

public MenuElement [] getSubElements()
이 메뉴 컴퍼넌트의 부메뉴를 포함하는 MenuElement 의 배열을 돌려줍니다. JMenuElement 인터페이스에 적합하는 항목만을 돌려줍니다. pop-up menu가 null 의 경우는 빈 상태(empty)의 배열을 돌려줍니다. 이 메소드는,MenuElement 인터페이스에 적합하기 위해서 필요합니다.

정의:
인터페이스 MenuElement 내의 getSubElements
반환값:
MenuElement 객체의 배열
관련 항목:
MenuElement.getSubElements()

getComponent

public Component  getComponent()
JPopupMenu 컴퍼넌트를 돌려줍니다.

정의:
인터페이스 MenuElement 내의 getComponent
반환값:
JPopupMenu 객체
관련 항목:
MenuElement.getComponent()

isPopupTrigger

public boolean isPopupTrigger(MouseEvent  e)
JPopupMenu 의 현재 인스톨 되고 있는 UI 가 MouseEvent 를 pop-up 트리거라고 보는 경우는, true 를 돌려줍니다.

반환값:
마우스 이벤트가 pop-up 트리거의 경우는 true
도입된 버젼:
1.3

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.