public class JPasswordField extends JTextField
JPasswordField は、1 行のテキストの編集を可能にする軽量コンポーネントです。何かが入力されたことはビューに示されますが、元の文字は表示されません。詳細や使用例については、「The Java Tutorial」の「How to Use Text Fields」を参照してください。
JPasswordField は、echoChar のセットとともに使用される java.awt.TextField とのソース互換のために用意されています。個別に提供されているのは、パスワードの入力に影響を与えることなしに、JTextField の UI を安全に、および簡単に変更できるようにするためです。
注: デフォルトでは、JPasswordField はインプットメソッドを無効にします。そうでない場合、入力文字はインプットメソッドを使用して構成されている間に可視だった可能性があります。アプリケーションでインプットメソッドのサポートが必要な場合は、継承された enableInputMethods(true) メソッドを使用してください。
警告: Swing はスレッドに対して安全ではありません。詳細は、「Swing's Threading Policy」を参照してください。
警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の格納や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。1.4 以降、すべての JavaBeansTM 用の長期間の格納サポートが java.beans パッケージに追加されています。XMLEncoder を参照してください。
| 修飾子と型 | クラスと説明 |
|---|---|
protected class |
JPasswordField.AccessibleJPasswordField
このクラスは
JPasswordField クラスのアクセシビリティーサポートを実装しています。 |
JTextField.AccessibleJTextFieldJTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBindingJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategynotifyActionDEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEYaccessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| コンストラクタと説明 |
|---|
JPasswordField()
新しい
JPasswordField を構築します。デフォルトのドキュメントを使用し、テキスト文字列は null で開始します。列の幅は 0 です。 |
JPasswordField(Document doc, String txt, int columns)
指定されたテキストストレージモデルと列数を使用する新規の
JPasswordField を構築します。 |
JPasswordField(int columns)
指定された列数で新規の空の
JPasswordField を構築します。 |
JPasswordField(String text)
指定されたテキストで初期化された新しい
JPasswordField を構築します。 |
JPasswordField(String text, int columns)
指定されたテキストおよび列で初期化される新規
JPasswordField を構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void |
copy()
現在の Look & Feel で
provideErrorFeedback を呼び出します。通常これは、エラービープ音を起動します。 |
void |
cut()
現在の Look & Feel で
provideErrorFeedback を呼び出します。通常これは、エラービープ音を起動します。 |
boolean |
echoCharIsSet()
JPasswordField にエコー表示に使用する文字セットが用意されている場合に true を返します。 |
AccessibleContext |
getAccessibleContext()
この
JPasswordField に関連付けられた AccessibleContext を返します。 |
char |
getEchoChar()
エコーに使用する文字を返します。
|
char[] |
getPassword()
この
TextComponent に格納されたテキストを返します。 |
String |
getText()
非推奨。
Java 2 プラットフォーム v1.2 以降は、
getPassword に置き換えられています。 |
String |
getText(int offs, int len)
非推奨。
Java 2 プラットフォーム v1.2 以降は、
getPassword に置き換えられています。 |
String |
getUIClassID()
このコンポーネントをレンダリングする L&F クラスの名前を返します。
|
protected String |
paramString()
この
JPasswordField の文字列表現を返します。 |
void |
setEchoChar(char c)
JPasswordField のエコー文字を設定します。 |
void |
updateUI()
プラグイン可能な UI を再ロードします。
|
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, isValidateRoot, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffsetaddCaretListener, addInputMethodListener, addKeymap, 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, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, viewToModel, writeaddAncestorListener, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, 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, transferFocusBackward, transferFocusUpCyclepublic JPasswordField()
JPasswordField を構築します。デフォルトのドキュメントを使用し、テキスト文字列は null で開始します。列の幅は 0 です。public JPasswordField(String text)
JPasswordField を構築します。ドキュメントモデルがデフォルトに設定され、列数は 0 です。text - 表示されるテキスト。ない場合は nullpublic JPasswordField(int columns)
JPasswordField を構築します。デフォルトモデルが作成され、初期文字列は null に設定されます。columns - 列数 >= 0public JPasswordField(String text, int columns)
JPasswordField を構築します。ドキュメントモデルがデフォルトに設定されます。text - 表示されるテキスト。ない場合は nullcolumns - 列数 >= 0public JPasswordField(Document doc, String txt, int columns)
JPasswordField を構築します。これは、ほかのコンストラクタが入力するコンストラクタです。エコー文字はアスタリスク (*) に設定されていますが、現在の Look & Feel を使って変更可能です。ドキュメントモデルが null の場合はデフォルトモデルが作成されます。doc - 使用するテキストストレージtxt - 表示されるテキスト。ない場合は nullcolumns - 適切な幅の計算に使用する列数。0 以上。列数を 0 に設定すると、適切な幅はコンポーネントの実装から自然に得られる値になるpublic String getUIClassID()
getUIClassID 、クラス: JTextFieldJComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)public void updateUI()
getUIClassID() です。UI のタイプは TextUI です。invalidate は、UI の設定後に呼び出されます。updateUI 、クラス: JTextComponentJComponent.setUI(javax.swing.plaf.ComponentUI), UIManager.getLookAndFeel(), UIManager.getUI(javax.swing.JComponent)public char getEchoChar()
setEchoChar(char), echoCharIsSet()public void setEchoChar(char c)
JPasswordField のエコー文字を設定します。このエコー文字は表示にすぎません。インストールされるビューは、任意のグラフィックな方法を使用してフィールドを表示できます。値を 0 に設定すると、標準の JTextField の動作と同様に、テキストを入力したとおりに表示させることを示します。c - 表示するエコー文字echoCharIsSet(), getEchoChar()public boolean echoCharIsSet()
JPasswordField にエコー表示に使用する文字セットが用意されている場合に true を返します。エコー文字が 0 でなければ、エコー文字が設定されていると解釈されます。setEchoChar(char), getEchoChar()public void cut()
provideErrorFeedback を呼び出します。通常これは、エラービープ音を起動します。関連したテキストモデル内の現在選択されている領域をシステムクリップボードに転送して、モデルからコンテンツを削除する通常の動作は、パスワードの入力フィールドには受け入れられません。cut 、クラス: JTextComponentToolkit.getSystemClipboard(), Clipboardpublic void copy()
provideErrorFeedback を呼び出します。通常これは、エラービープ音を起動します。関連したテキストモデル内の現在選択されている領域をシステムクリップボードに転送して、モデルにコンテンツを残す通常の動作は、パスワードの入力フィールドには受け入れられません。copy 、クラス: JTextComponentToolkit.getSystemClipboard(), Clipboard@Deprecated public String getText()
getPassword に置き換えられています。TextComponent に格納されたテキストを返します。ベースとなるドキュメントが null の場合は、NullPointerException を返します。
セキュリティー上の理由から、このメソッドは非推奨です。代わりに * getPassword メソッドを使用してください。
getText 、クラス: JTextComponentJTextComponent.setText(java.lang.String)@Deprecated public String getText(int offs, int len) throws BadLocationException
getPassword に置き換えられています。
セキュリティー上の理由から、このメソッドは非推奨です。代わりに getPassword メソッドを使用してください。
getText 、クラス: JTextComponentoffs - オフセット >= 0len - 長さ >= 0BadLocationException - オフセットまたは長さが無効な場合public char[] getPassword()
TextComponent に格納されたテキストを返します。ベースとなるドキュメントが null の場合は、NullPointerException を返します。セキュリティー強化のために、返された文字の配列を使用したあとは、各文字をゼロに設定してクリアすることをお勧めします。protected String paramString()
JPasswordField の文字列表現を返します。このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。返される文字列は空の場合がありますが、null にはなりません。paramString 、クラス: JTextFieldJPasswordField の文字列表現public AccessibleContext getAccessibleContext()
JPasswordField に関連付けられた AccessibleContext を返します。パスワードフィールドの場合、AccessibleContext は AccessibleJPasswordField の形式を取ります。必要に応じて、新しい AccessibleJPasswordField インスタンスが作成されます。getAccessibleContext 、インタフェース: AccessiblegetAccessibleContext 、クラス: JTextFieldJPasswordField の AccessibleContext として機能する AccessibleJPasswordField バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.