JavaTM Platform
Standard Ed. 6

javax.swing
클래스 JTextField

java.lang.Object 
  상위를 확장 java.awt.Component 
      상위를 확장 java.awt.Container 
          상위를 확장 javax.swing.JComponent 
              상위를 확장 javax.swing.text.JTextComponent 
                  상위를 확장 javax.swing.JTextField
모든 구현된 인터페이스:
ImageObserver , MenuContainer , Serializable , Accessible , Scrollable , SwingConstants
직계의 기존의 서브 클래스:
DefaultTreeCellEditor.DefaultTextField , JFormattedTextField , JPasswordField


public class JTextField
extends JTextComponent
implements SwingConstants

JTextField 는, 1 행의 텍스트의 편집을 가능하게 하는 경량 컴퍼넌트입니다. 텍스트 필드의 상세와 사용예에 대해서는, 「The Java Tutorial」의「How to Use Text Fields」를 참조해 주세요.

JTextField 는, 이 처리를 적절히 실시하는 java.awt.TextField 클래스와의 소스 호환성을 제공하기 위해서 준비되어 있습니다. 이 컴퍼넌트는,java.awt.TextField 클래스에는 없는 기능을 갖추고 있습니다. 추가 기능에 대해서는, 슈퍼 클래스를 참조해 주세요.  

JTextField 는, 발생하는 액션 이벤트의 커멘드 캐릭터 라인으로서 사용하는 캐릭터 라인을 확정하는 메소드를 가집니다. java.awt.TextField 는, 필드의 텍스트를 ActionEvent 의 커멘드 캐릭터 라인으로서 사용했습니다. JTextFieldnull 가 아니면,setActionCommand 메소드로 설정된 커멘드 캐릭터 라인을 사용합니다. 그 이외의 경우는, 필드의 텍스트를 java.awt.TextField 와의 호환기능으로서 사용합니다.  

플러그 인 가능한 Look & Feel 의 새로운 구현이 패스워드 캐릭터 라인을 우발적으로 표시해 버리지 않게 하기 위해서,setEchoChar 메소드와 getEchoChar 메소드는 직접은 제공은 되지 않습니다. 패스워드 양식의 서비스를 제공하기 위해서는, 이것과는 다른 JPasswordField 클래스가 JTextField 를 확장해 도입되어 독자적으로 플러그 인 가능한 Look & Feel 에 이 서비스를 제공합니다.  

java.awt.TextField 의 변경을 감시하려면 ,TextEventTextListener를 추가합니다. JTextComponent 베이스의 컴퍼넌트에서는,DocumentEvent 경유로 모델로부터 DocumentListeners 로 변경이 보내집니다. DocumentEvent 는, 필요에 따라서, 변경 위치라고 변경의 종류를 제공합니다. 이 부분의 코드는 다음과 같이 됩니다.


    DocumentListener myListener = ??;
    JTextField myArea = ??;
    myArea.getDocument(). addDocumentListener(myListener);
 

JTextField 의 수평 배치는, 왼쪽 가지런히 해 centering, 오른쪽맞춤, 또는 말미 조정으로 설정할 수 있습니다. 필드 텍스트의 필요한 사이즈가 그 필드에 할당할 수 있었던 사이즈보다 작은 경우는, 오른쪽맞춤과 말미 조정은 편리합니다. 이것은 setHorizontalAlignment 메소드와 getHorizontalAlignment 메소드에 의해 지정됩니다. 디폴트에서는, 왼쪽 가지런히 하가 됩니다.  

텍스트 필드가 VK_ENTER 이벤트를 소비하는 방법은, 이 텍스트 필드에 액션 청취자가 있을지 어떨지에 따라서 다릅니다. 액션 청취자가 있는 경우는, VK_ENTER 에 의해 청취자에게 ActionEvent 가 돌려주어져 VK_ENTER 이벤트가 소비됩니다. 이것은, AWT 텍스트 필드가 VK_ENTER 이벤트를 처리하는 방법과 호환성이 있습니다. 텍스트 필드에 액션 청취자가 없는 경우, v 1.3 에서는, VK_ENTER 이벤트는 소비되지 않습니다. 대신에, 상위 클래스의 컴퍼넌트의 바인딩이 처리되어, JFC/Swing 의 디폴트 버튼 기능을 사용할 수 있습니다.  

커스터마이즈 된 필드를 간단하게 작성하려면 , 모델을 확장해, 제공되는 디폴트 모델을 변경합니다. 예를 들어 다음의 코드의 일부는, 대문자만을 보관 유지하는 필드를 작성합니다. 이것은, 텍스트가 클립보드로부터 페이스트 되거나 프로그램에 근거해 변경되어도 기능합니다.



 public class UpperCaseField extends JTextField {
 
     public UpperCaseField(int cols) {
         super(cols);
     }
 
     protected Document createDefaultModel() {
         return new UpperCaseDocument();
     }
 
     static class UpperCaseDocument extends PlainDocument {
 
         public void insertString(int offs, String str, AttributeSet a) 
             throws BadLocationException {
 
             if (str == null) {
                 return;
             }
             char[] upper = str.toCharArray();
             for (int i = 0; i < upper.length; i++) {
                 upper[i] = Character.toUpperCase(upper[i]);
             }
             super.insertString(offs, new String(upper), a);
         }
     }
 }

 

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

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

관련 항목:
setActionCommand(java.lang.String) , JPasswordField , addActionListener(java.awt.event.ActionListener)

상자의 클래스의 개요
protected  class JTextField.AccessibleJTextField
          이 클래스는 JTextField 클래스용의 접근성? 지원를 구현하고 있습니다.
 
클래스 javax.swing.text. JTextComponent 로부터 상속된 상자의 클래스/인터페이스
JTextComponent.AccessibleJTextComponent , JTextComponent.DropLocation , JTextComponent.KeyBinding
 
클래스 javax.swing. JComponent 로부터 상속된 상자의 클래스/인터페이스
JComponent.AccessibleJComponent
 
클래스 java.awt. Container 로부터 상속된 상자의 클래스/인터페이스
Container.AccessibleAWTContainer
 
클래스 java.awt. Component 로부터 상속된 상자의 클래스/인터페이스
Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , Component.BltBufferStrategy , Component.FlipBufferStrategy
 
필드의 개요
static String notifyAction
          필드의 내용을 받아들일 수 있었다고 하는 통지를 보내는 액션의 이름입니다.
 
클래스 javax.swing.text. JTextComponent 로부터 상속된 필드
DEFAULT_KEYMAP , FOCUS_ACCELERATOR_KEY
 
클래스 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
 
인터페이스 javax.swing. SwingConstants 로부터 상속된 필드
BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST
 
인터페이스 java.awt.image. ImageObserver 로부터 상속된 필드
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH
 
생성자 의 개요
JTextField ()
          새로운 TextField 를 구축합니다.
JTextField (Document  doc, String  text, int columns)
          지정된 텍스트 스토리지 모델과 렬수를 사용해 새로운 JTextField 를 구축합니다.
JTextField (int columns)
          지정된 렬수로 새로운 빈 상태(empty)의 TextField 를 구축합니다.
JTextField (String  text)
          지정된 텍스트로 초기화되는 새로운 TextField 를 구축합니다.
JTextField (String  text, int columns)
          지정된 텍스트 및 열로 초기화되는 신규 TextField 를 구축합니다.
 
메소드의 개요
protected  void actionPropertyChanged (Action  action, String  propertyName)
          관련 액션의 프로퍼티의 변경에 응해 텍스트 필드 상태를 갱신합니다.
 void addActionListener (ActionListener  l)
          지정된 액션 청취자를 추가해, 액션 이벤트를 이 텍스트 필드로부터 받습니다.
protected  void configurePropertiesFromAction (Action  a)
          지정된 Action 의 프로퍼티에 일치하도록(듯이), 이 텍스트 필드에 프로퍼티을 설정합니다.
protected  PropertyChangeListener createActionPropertyChangeListener (Action  a)
          지정의 Action 로부터의 변경을 대기해, 적절한 프로퍼티을 갱신하는 PropertyChangeListener 를 작성해, 돌려줍니다.
protected  Document createDefaultModel ()
          모델이 명시적으로 지정되지 않는 경우는, 구축시에 사용하는 모델의 디폴트 구현을 작성합니다.
protected  void fireActionPerformed ()
          통지의 전달 대상을, 지정된 이벤트형으로 등록한 모든 청취자에게 통지합니다.
 AccessibleContext getAccessibleContext ()
          이 JTextField 에 관련하는 AccessibleContext 를 돌려줍니다.
 Action getAction ()
          이 ActionEvent 소스에 현재 설정되어 있는 Action 를 돌려줍니다.
 ActionListener [] getActionListeners ()
          addActionListener()에 의해 이 JTextField 에 추가된 전 ActionListener 의 배열을 돌려줍니다.
 Action [] getActions ()
          에디터의 커멘드 리스트를 꺼냅니다.
 int getColumns ()
          이 TextField 의 렬수를 돌려줍니다.
protected  int getColumnWidth ()
          렬폭을 가져옵니다.
 int getHorizontalAlignment ()
          텍스트의 수평 배치를 돌려줍니다.
 BoundedRangeModel getHorizontalVisibility ()
          텍스트 필드의 가시성을 돌려줍니다.
 Dimension getPreferredSize ()
          이 TextField 에 필요하게 되는 적절한 사이즈 Dimensions 를 돌려줍니다.
 int getScrollOffset ()
          픽셀 단위의 스크롤 오프셋(offset)를 돌려줍니다.
 String getUIClassID ()
          UI 의 클래스 ID 를 돌려줍니다.
 boolean isValidateRoot ()
          텍스트 필드 자신중에서 불려 가는 revalidate 는, 텍스트 필드의 타당성을 검증하는 것에 의해 처리됩니다.
protected  String paramString ()
          이 JTextField 의 캐릭터 라인 표현을 돌려줍니다.
 void postActionEvent ()
          이 텍스트 필드로 발생하는 액션 이벤트를, 등록을 마친 ActionListener 객체의 어느 쪽인가에 발송 하는 것으로 처리합니다.
 void removeActionListener (ActionListener  l)
          지정된 액션 청취자를 삭제해, 액션 이벤트를 이 텍스트 필드로부터 그 이상 받지 않게 합니다.
 void scrollRectToVisible (Rectangle  r)
          필드를 왼쪽 또는 오른쪽으로 스크롤 합니다.
 void setAction (Action  a)
          ActionEvent 소스에 Action 를 설정합니다.
 void setActionCommand (String  command)
          액션 이벤트에 사용하는 커멘드 캐릭터 라인을 설정합니다.
 void setColumns (int columns)
          이 TextField 의 렬수를 설정해, 배치를 무효로 합니다.
 void setDocument (Document  doc)
          에디터를 텍스트 문서에 관련짓습니다.
 void setFont (Font  f)
          현재의 폰트를 설정합니다.
 void setHorizontalAlignment (int alignment)
          텍스트의 수평 배치를 설정합니다.
 void setScrollOffset (int scrollOffset)
          픽셀 단위의 스크롤 오프셋(offset)를 설정합니다.
 
클래스 javax.swing.text. JTextComponent 로부터 상속된 메소드
addCaretListener , addInputMethodListener , addKeymap , copy , cut , fireCaretUpdate , getCaret , getCaretColor , getCaretListeners , getCaretPosition , getDisabledTextColor , getDocument , getDragEnabled , getDropLocation , getDropMode , getFocusAccelerator , getHighlighter , getInputMethodRequests , getKeymap , getKeymap , getMargin , getNavigationFilter , getPreferredScrollableViewportSize , getPrintable , getScrollableBlockIncrement , getScrollableTracksViewportHeight , getScrollableTracksViewportWidth , getScrollableUnitIncrement , getSelectedText , getSelectedTextColor , getSelectionColor , getSelectionEnd , getSelectionStart , getText , getText , getToolTipText , getUI , isEditable , loadKeymap , modelToView , moveCaretPosition , paste , print , print , print , processInputMethodEvent , read , removeCaretListener , removeKeymap , removeNotify , replaceSelection , select , selectAll , setCaret , setCaretColor , setCaretPosition , setComponentOrientation , setDisabledTextColor , setDragEnabled , setDropMode , setEditable , setFocusAccelerator , setHighlighter , setKeymap , setMargin , setNavigationFilter , setSelectedTextColor , setSelectionColor , setSelectionEnd , setSelectionStart , setText , setUI , updateUI , viewToModel , write
 
클래스 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 , getRegisteredKeyStrokes , getRootPane , getSize , getToolTipLocation , getToolTipText , getTopLevelAncestor , getTransferHandler , getVerifyInputWhenFocusTarget , getVetoableChangeListeners , getVisibleRect , getWidth , getX , getY , grabFocus , isDoubleBuffered , isLightweightComponent , isManagingFocus , isOpaque , isOptimizedDrawingEnabled , isPaintingForPrint , isPaintingTile , isRequestFocusEnabled , paint , paintBorder , paintChildren , paintComponent , paintImmediately , paintImmediately , print , printAll , printBorder , printChildren , printComponent , processComponentKeyEvent , processKeyBinding , processKeyEvent , processMouseEvent , processMouseMotionEvent , putClientProperty , registerKeyboardAction , registerKeyboardAction , removeAncestorListener , removeVetoableChangeListener , repaint , repaint , requestDefaultFocus , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , resetKeyboardActions , reshape , revalidate , setActionMap , setAlignmentX , setAlignmentY , setAutoscrolls , setBackground , setBorder , setComponentPopupMenu , setDebugGraphicsOptions , setDefaultLocale , setDoubleBuffered , setEnabled , setFocusTraversalKeys , setForeground , setInheritsPopupMenu , setInputMap , setInputVerifier , setMaximumSize , setMinimumSize , setNextFocusableComponent , setOpaque , setPreferredSize , setRequestFocusEnabled , setToolTipText , setTransferHandler , setUI , setVerifyInputWhenFocusTarget , setVisible , 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 , remove , removeAll , removeContainerListener , setComponentZOrder , setFocusCycleRoot , setFocusTraversalPolicy , setFocusTraversalPolicyProvider , setLayout , transferFocusBackward , transferFocusDownCycle , validate , validateTree
 
클래스 java.awt. Component 로부터 상속된 메소드
action , add , addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , 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 , 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 , isVisible , keyDown , keyUp , list , list , list , location , lostFocus , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paintAll , postEvent , prepareImage , prepareImage , processComponentEvent , processFocusEvent , processHierarchyBoundsEvent , processHierarchyEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , resize , resize , setBounds , setBounds , setCursor , setDropTarget , setFocusable , setFocusTraversalKeysEnabled , setIgnoreRepaint , setLocale , setLocation , setLocation , setName , setSize , setSize , show , show , size , toString , transferFocus , transferFocusUpCycle
 
클래스 java.lang. Object 로부터 상속된 메소드
clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait
 

필드의 상세

notifyAction

public static final String  notifyAction
필드의 내용을 받아들일 수 있었다고 하는 통지를 보내는 액션의 이름입니다. 일반적으로, 이것은 복귀 동작에 할당할 수 있습니다.

관련 항목:
정수 필드치
생성자 의 상세

JTextField

public JTextField()
새로운 TextField 를 구축합니다. 디폴트 모델이 작성되어 초기 캐릭터 라인은 null 로, 렬수가 0 으로 설정됩니다.


JTextField

public JTextField(String  text)
지정된 텍스트로 초기화되는 새로운 TextField 를 구축합니다. 디폴트 모델이 작성되어 렬수는 0 입니다.

파라미터:
text - 표시되는 텍스트 또는 null

JTextField

public JTextField(int columns)
지정된 렬수로 새로운 빈 상태(empty)의 TextField 를 구축합니다. 디폴트 모델이 작성되어 초기 캐릭터 라인은 null 로 설정됩니다.

파라미터:
columns - 적절한 폭의 계산에 사용하는 렬수. 렬수를 0 으로 설정하면(자), 적절한 폭은 컴퍼넌트의 구현으로부터 자연스럽게 얻을 수 있다 값이 된다

JTextField

public JTextField(String  text,
                  int columns)
지정된 텍스트 및 열로 초기화되는 신규 TextField 를 구축합니다. 디폴트 모델이 작성됩니다.

파라미터:
text - 표시되는 텍스트 또는 null
columns - 적절한 폭의 계산에 사용하는 렬수. 렬수를 0 으로 설정하면(자), 적절한 폭은 컴퍼넌트의 구현으로부터 자연스럽게 얻을 수 있다 값이 된다

JTextField

public JTextField(Document  doc,
                  String  text,
                  int columns)
지정된 텍스트 스토리지 모델과 렬수를 사용해 새로운 JTextField 를 구축합니다. 이것은, 다른 생성자 이 입력하는 생성자 입니다. 문서가 null 의 경우는 디폴트 모델이 작성됩니다.

파라미터:
doc - 사용하는 텍스트 스토리지. null 의 경우는,createDefaultModel 메소드를 호출하는 것에 의해 디폴트의 값이 제공되는
text - 표시하는 초기 캐릭터 라인 또는 null
columns - 적절한 폭의 계산에 사용하는 렬수. 적절한 폭은 0 이상. columns 를 0 으로 설정했을 경우, 적절한 폭은 컴퍼넌트의 구현으로부터 자연스럽게 얻을 수 있는 값이 된다
예외:
IllegalArgumentException - columns가 < 0 의 경우
메소드의 상세

getUIClassID

public String  getUIClassID()
UI 의 클래스 ID 를 돌려줍니다.

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

setDocument

public void setDocument(Document  doc)
에디터를 텍스트 문서에 관련짓습니다. 현재 등록을 마친 팩토리를 사용하면(자), 문서의 뷰를 구축할 수 있습니다. 이 뷰는, 재검증 후에 에디터에 의해 표시됩니다. PropertyChange 이벤트 (document)는, 각 청취자에게 통지됩니다.

오버라이드(override):
클래스 JTextComponent 내의 setDocument
파라미터:
doc - 표시 및 편집하는 문서
관련 항목:
JTextComponent.getDocument()

isValidateRoot

public boolean isValidateRoot()
텍스트 필드 자신중에서 불려 가는 revalidate 는, 텍스트 필드의 타당성을 검증하는 것에 의해 처리됩니다. 다만, 텍스트 필드가 JViewport 내에 포함되지 않은 경우는 false 를 돌려줍니다.

오버라이드(override):
클래스 JComponent 내의 isValidateRoot
반환값:
이 텍스트 필드의 부모가 JViewPort 의 경우는 false, 그렇지 않은 경우는 true
관련 항목:
JComponent.revalidate() , JComponent.isValidateRoot()

getHorizontalAlignment

public int getHorizontalAlignment()
텍스트의 수평 배치를 돌려줍니다. 유효한 키는 다음과 같습니다.

반환값:
수평 배치

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
텍스트의 수평 배치를 설정합니다. 유효한 키는 다음과 같습니다. 배치가 설정되면(자) invalidaterepaint 가 불려 가PropertyChange 이벤트 (horizontalAlignment)가 트리거됩니다.

파라미터:
alignment - 배치 방법
예외:
IllegalArgumentException - alignment 가 유효한 키가 아닌 경우

createDefaultModel

protected Document  createDefaultModel()
모델이 명시적으로 지정되지 않는 경우는, 구축시에 사용하는 모델의 디폴트 구현을 작성합니다. PlainDocument 의 인스턴스가 돌려주어집니다.

반환값:
디폴트 모델의 구현

getColumns

public int getColumns()
TextField 의 렬수를 돌려줍니다.

반환값:
렬수 >= 0

setColumns

public void setColumns(int columns)
TextField 의 렬수를 설정해, 배치를 무효로 합니다.

파라미터:
columns - 렬수 >= 0
예외:
IllegalArgumentException - columns 0 보다 작은 경우

getColumnWidth

protected int getColumnWidth()
렬폭을 가져옵니다. 폰트에 따라서는, 열은 약한 의미 밖에 가지지 않습니다. 이 메소드를 사용하면(자), 1 열의 폭을 정의할 수 있습니다. 이것은 디폴트로, 사용 폰트의 문자 「m」의 폭으로 정의됩니다. 이 메소드는, 다른 폭이 되도록(듯이) 재정의할 수 있습니다.

반환값:
렬폭 >= 1

getPreferredSize

public Dimension  getPreferredSize()
TextField 에 필요하게 되는 적절한 사이즈 Dimensions 를 돌려줍니다. 제로 이외의 렬수가 설정되어 있으면(자), 그 폭은 렬수를 렬폭 나간 값으로 설정됩니다.

오버라이드(override):
클래스 JComponent 내의 getPreferredSize
반환값:
이 텍스트 필드의 치수
관련 항목:
JComponent.setPreferredSize(java.awt.Dimension) , ComponentUI

setFont

public void setFont(Font  f)
현재의 폰트를 설정합니다. 캐쉬된 행의 높이와 열의 폭을 삭제하므로, 새로운 폰트의 설정이 반영됩니다. revalidate 는, 폰트 설정 후에 불려 갑니다.

오버라이드(override):
클래스 JComponent 내의 setFont
파라미터:
f - 신규 폰트
관련 항목:
Component.getFont()

addActionListener

public void addActionListener(ActionListener  l)
지정된 액션 청취자를 추가해, 액션 이벤트를 이 텍스트 필드로부터 받습니다.

파라미터:
l - 추가되는 액션 청취자

removeActionListener

public void removeActionListener(ActionListener  l)
지정된 액션 청취자를 삭제해, 액션 이벤트를 이 텍스트 필드로부터 그 이상 받지 않게 합니다.

파라미터:
l - 삭제되는 액션 청취자

getActionListeners

public ActionListener [] getActionListeners()
addActionListener()에 의해 이 JTextField 에 추가된 전 ActionListener 의 배열을 돌려줍니다.

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

fireActionPerformed

protected void fireActionPerformed()
통지의 전달 대상을, 지정된 이벤트형으로 등록한 모든 청취자에게 통지합니다. 이벤트 인스턴스가 작성됩니다. 청취자 리스트는 내림차순 방식에서 처리됩니다.

관련 항목:
EventListenerList

setActionCommand

public void setActionCommand(String  command)
액션 이벤트에 사용하는 커멘드 캐릭터 라인을 설정합니다.

파라미터:
command - 커멘드 캐릭터 라인

setAction

public void setAction(Action  a)
ActionEvent 소스에 Action 를 설정합니다. 새로운 Action 는 설정 끝난 Action 와 옮겨집니다만,addActionListener 로 독립해 추가된 ActionListener 에는 영향을 주지 않습니다. Action 가 벌써 ActionEvent 소스에 벌써 등록되어 있는 ActionListener 인 경우는, 재등록되지 않습니다.  

Action 를 설정하면(자),Action 를 지원하는 Swing 컴퍼넌트」로 설명 떠날 수 있어 모든 프로퍼티이 즉시 변경됩니다. 계속되어,Action 의 프로퍼티의 변경에 맞추어, 텍스트 필드의 프로퍼티이 자동적으로 갱신됩니다.  

이 메소드는,Action 의 프로퍼티치를 설정해, 추적하기 위해서, 다른 3 개의 메소드를 사용합니다. 이 메소드는, 텍스트 필드의 프로퍼티을 즉시 변경하기 위해서,configurePropertiesFromAction 메소드를 사용합니다. Action 의 프로퍼티치의 변경을 추적하기 위해서는,createActionPropertyChangeListener 로부터 반환되는 PropertyChangeListener 를 등록합니다. 디폴트의 PropertyChangeListener 는,Action 의 프로퍼티으로 변경이 있으면(자),actionPropertyChanged 메소드를 호출합니다.

파라미터:
a - JTextFieldAction, 또는 null
도입된 버젼:
1.3
관련 항목:
Action , getAction() , configurePropertiesFromAction(javax.swing.Action) , createActionPropertyChangeListener(javax.swing.Action) , actionPropertyChanged(javax.swing.Action, java.lang.String)

getAction

public Action  getAction()
ActionEvent 소스에 현재 설정되어 있는 Action 를 돌려줍니다. Action 가 설정되어 있지 않은 경우는,null 가 돌려주어집니다.

반환값:
ActionEvent 소스의 Action, 또는 null
도입된 버젼:
1.3
관련 항목:
Action , setAction(javax.swing.Action)

configurePropertiesFromAction

protected void configurePropertiesFromAction(Action  a)
지정된 Action 의 프로퍼티에 일치하도록(듯이), 이 텍스트 필드에 프로퍼티을 설정합니다. 이것에 의해 설정되는 프로퍼티의 자세한 것은,Action 를 지원하는 Swing 컴퍼넌트」를 참조해 주세요.

파라미터:
a - 프로퍼티을 취득하는 Action, 또는 null
도입된 버젼:
1.3
관련 항목:
Action , setAction(javax.swing.Action)

actionPropertyChanged

protected void actionPropertyChanged(Action  action,
                                     String  propertyName)
관련 액션의 프로퍼티의 변경에 응해 텍스트 필드 상태를 갱신합니다. 이 메소드는,createActionPropertyChangeListener 로부터 반환되는 PropertyChangeListener 로부터 불려 갑니다. 서브 클래스는, 일반적으로, 이것을 호출할 필요는 없습니다. 추가의 Action 프로퍼티을 지원하는 서브 클래스는, 이것과 configurePropertiesFromAction 를 오버라이드(override) 할 것입니다.  

이 메소드에 의해 설정되는 프로퍼티의 리스트는,Action 를 지원하는 Swing 컴퍼넌트」의 겉(표)를 참조해 주세요.

파라미터:
action - 이 텍스트 필드에 관련지을 수 있었던 Action
propertyName - 변경된 프로퍼티의 이름
도입된 버젼:
1.6
관련 항목:
Action , configurePropertiesFromAction(javax.swing.Action)

createActionPropertyChangeListener

protected PropertyChangeListener  createActionPropertyChangeListener(Action  a)
지정의 Action 로부터의 변경을 대기해, 적절한 프로퍼티을 갱신하는 PropertyChangeListener 를 작성해, 돌려줍니다.  

경고: 이것을 서브 클래스화하는 경우, 익명의 내부 클래스는 작성하지 말아 주세요. 작성하면(자), 텍스트 필드의 수명이 Action 의 수명에 구속됩니다.

파라미터:
a - 텍스트 필드의 액션
도입된 버젼:
1.3
관련 항목:
Action , setAction(javax.swing.Action)

getActions

public Action [] getActions()
에디터의 커멘드 리스트를 꺼냅니다. 이것은, 에디터 자신이 지원하는 커멘드 컬렉션으로 확장된, 플러그 인이 끝난 UI 에 의해 지원되는 커멘드의 리스트입니다. 이것들은, 키 맵내와 같이, 이벤트에의 할당에 도움이 됩니다.

오버라이드(override):
클래스 JTextComponent 내의 getActions
반환값:
커멘드 리스트

postActionEvent

public void postActionEvent()
이 텍스트 필드로 발생하는 액션 이벤트를, 등록을 마친 ActionListener 객체의 어느 쪽인가에 발송 하는 것으로 처리합니다. 이것은 일반적으로, 텍스트 필드에 등록된 콘트롤러에 의해 불려 갑니다.


getHorizontalVisibility

public BoundedRangeModel  getHorizontalVisibility()
텍스트 필드의 가시성을 돌려줍니다. 이것을 조정하면(자), 필드의 사이즈를 할당할 수 있었던 가시 영역보다 큰 경우에 그 영역의 위치를 변경할 수 있습니다.

필드의 Look & Feel 의 구현은,BoundedRangeModel 의 최소치, 최대치, 길이의 각 프로퍼티의 값을 관리합니다.

반환값:
가시성
관련 항목:
BoundedRangeModel

getScrollOffset

public int getScrollOffset()
픽셀 단위의 스크롤 오프셋(offset)를 돌려줍니다.

반환값:
오프셋(offset) >= 0

setScrollOffset

public void setScrollOffset(int scrollOffset)
픽셀 단위의 스크롤 오프셋(offset)를 설정합니다.

파라미터:
scrollOffset - 오프셋(offset) >= 0

scrollRectToVisible

public void scrollRectToVisible(Rectangle  r)
필드를 왼쪽 또는 오른쪽으로 스크롤 합니다.

오버라이드(override):
클래스 JComponent 내의 scrollRectToVisible
파라미터:
r - 스크롤 대상의 범위
관련 항목:
JViewport

paramString

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

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

getAccessibleContext

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

정의:
인터페이스 Accessible 내의 getAccessibleContext
오버라이드(override):
클래스 JTextComponent 내의 getAccessibleContext
반환값:
JTextFieldAccessibleContext 로서 기능하는 AccessibleJTextField

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 도 참조해 주세요.