public class TextArea extends TextComponent
TextArea オブジェクトは、テキストを表示する複数行領域です。編集可能に設定することも、読み込み専用に設定することもできます。
次の図は、テキスト領域の外観を示します。
このテキスト領域は、次のコードによって作成できます。
new TextArea("Hello", 5, 40);
| 修飾子と型 | クラスと説明 |
|---|---|
protected class |
TextArea.AccessibleAWTTextArea
このクラスは
TextArea クラスのアクセシビリティーサポートを実装しています。 |
TextComponent.AccessibleAWTTextComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| 修飾子と型 | フィールドと説明 |
|---|---|
static int |
SCROLLBARS_BOTH
水平と垂直スクロールバーを作成し、表示します。
|
static int |
SCROLLBARS_HORIZONTAL_ONLY
水平スクロールバーだけを作成し、表示します。
|
static int |
SCROLLBARS_NONE
このテキスト領域のどのスクロールバーも作成しません。
|
static int |
SCROLLBARS_VERTICAL_ONLY
垂直スクロールバーだけを作成し、表示します。
|
textListenerBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| コンストラクタと説明 |
|---|
TextArea()
空の文字列で新しいテキスト領域を構築します。
|
TextArea(int rows, int columns)
指定された行数と列数と空のテキスト文字列を持つ新しいテキスト領域を構築します。
|
TextArea(String text)
指定されたテキストで新しいテキスト領域を構築します。
|
TextArea(String text, int rows, int columns)
指定された行数と列数を持つ空のテキスト領域を、指定されたテキストで構築します。
|
TextArea(String text, int rows, int columns, int scrollbars)
指定された行数および列数の、指定されたテキストが表示される新しいテキスト領域を、指定されたスクロールバーの可視性で構築します。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
void |
addNotify()
TextArea のピアを作成します。 |
void |
append(String str)
テキスト領域の現在のテキストに、指定されたテキストを追加します。
|
void |
appendText(String str)
非推奨。
JDK version 1.1 以降は、
append(String) に置き換えられています。 |
AccessibleContext |
getAccessibleContext()
この
TextArea に関連付けられた AccessibleContext を返します。 |
int |
getColumns()
このテキスト領域の列数を返します。
|
Dimension |
getMinimumSize()
このテキスト領域の最小サイズを判定します。
|
Dimension |
getMinimumSize(int rows, int columns)
指定された行数および列数のテキスト領域の最小サイズを判定します。
|
Dimension |
getPreferredSize()
このテキスト領域の推奨サイズを判定します。
|
Dimension |
getPreferredSize(int rows, int columns)
指定された行数および列数のテキスト領域の推奨サイズを判定します。
|
int |
getRows()
テキスト領域の行数を返します。
|
int |
getScrollbarVisibility()
テキスト領域が使用するスクロールバーを示す列挙された値を返します。
|
void |
insert(String str, int pos)
このテキスト領域内の指定された位置に、指定されたテキストを挿入します。
|
void |
insertText(String str, int pos)
非推奨。
JDK version 1.1 以降は、
insert(String, int) に置き換えられています。 |
Dimension |
minimumSize()
非推奨。
JDK version 1.1 以降は、
getMinimumSize() に置き換えられています。 |
Dimension |
minimumSize(int rows, int columns)
非推奨。
JDK version 1.1 以降は、
getMinimumSize(int, int) に置き換えられています。 |
protected String |
paramString()
この
TextArea の状態を表す文字列を返します。 |
Dimension |
preferredSize()
非推奨。
JDK version 1.1 以降は、
getPreferredSize() に置き換えられています。 |
Dimension |
preferredSize(int rows, int columns)
非推奨。
JDK version 1.1 以降は、
getPreferredSize(int, int) に置き換えられています。 |
void |
replaceRange(String str, int start, int end)
指定された始点と終点の間のテキストを、指定されたテキストに置き換えます。
|
void |
replaceText(String str, int start, int end)
非推奨。
JDK version 1.1 以降は、
replaceRange(String, int, int) に置き換えられています。 |
void |
setColumns(int columns)
このテキスト領域の列数を設定します。
|
void |
setRows(int rows)
このテキスト領域の行数を設定します。
|
addTextListener, enableInputMethods, getBackground, getCaretPosition, getInputMethodRequests, getListeners, getSelectedText, getSelectionEnd, getSelectionStart, getText, getTextListeners, isEditable, processEvent, processTextEvent, removeNotify, removeTextListener, select, selectAll, setBackground, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart, setTextaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validatepublic static final int SCROLLBARS_BOTH
public static final int SCROLLBARS_VERTICAL_ONLY
public static final int SCROLLBARS_HORIZONTAL_ONLY
public static final int SCROLLBARS_NONE
public TextArea()
throws HeadlessException
SCROLLBARS_BOTH に等しいスクロールバーの可視性で作成されるため、このテキスト領域では、垂直スクロールバーと水平スクロールバーの両方が表示されます。HeadlessException - GraphicsEnvironment.isHeadless が true を返した場合GraphicsEnvironment.isHeadless()public TextArea(String text) throws HeadlessException
SCROLLBARS_BOTH に等しいスクロールバーの可視性で作成されるため、このテキスト領域では、垂直スクロールバーと水平スクロールバーの両方が表示されます。text - 表示されるテキスト。text が null である場合は、空の文字列 "" が表示されるHeadlessException - GraphicsEnvironment.isHeadless が true を返した場合GraphicsEnvironment.isHeadless()public TextArea(int rows,
int columns)
throws HeadlessException
SCROLLBARS_BOTH に等しいスクロールバーの可視性で作成されるため、このテキスト領域では、垂直スクロールバーと水平スクロールバーの両方が表示されます。rows - 行の数columns - 列の数HeadlessException - GraphicsEnvironment.isHeadless が true を返した場合GraphicsEnvironment.isHeadless()public TextArea(String text, int rows, int columns) throws HeadlessException
SCROLLBARS_BOTH に等しいスクロールバーの可視性で作成されるため、このテキスト領域では、垂直スクロールバーと水平スクロールバーの両方が表示されます。text - 表示されるテキスト。text が null である場合は、空の文字列 "" が表示されるrows - 行の数columns - 列の数HeadlessException - GraphicsEnvironment.isHeadless が true を返した場合GraphicsEnvironment.isHeadless()public TextArea(String text, int rows, int columns, int scrollbars) throws HeadlessException
TextArea コンストラクタはこのコンストラクタに従います。
TextArea クラスは、scrollbars 引数の値として指定できる次のようないくつかの定数を定義します。
SCROLLBARS_BOTH,
SCROLLBARS_VERTICAL_ONLY,
SCROLLBARS_HORIZONTAL_ONLY,
SCROLLBARS_NONE.
scrollbars 引数のその他の値は無効となり、その場合このテキスト領域はデフォルト値 SCROLLBARS_BOTH に等しいスクロールバーの可視性で作成されます。text - 表示されるテキスト。text が null である場合は、空の文字列 "" が表示されるrows - 行数。rows が 0 より小さい場合、rows は 0 に設定されるcolumns - 列数。columns が 0 より小さい場合、columns は 0 に設定されるscrollbars - テキスト領域を表示するためにどのスクロールバーが作成されるかを指定する定数HeadlessException - GraphicsEnvironment.isHeadless が true を返した場合GraphicsEnvironment.isHeadless()public void addNotify()
TextArea のピアを作成します。ピアを使用すると、TextArea の機能を変更せずに外観を変更することができます。addNotify、クラス: TextComponentTextComponent.removeNotify()public void insert(String str, int pos)
null や整合性のないパラメータを渡すことは無効であり、指定されていない動作の原因になることに注意してください。
str - 挿入する null 以外のテキストpos - 挿入する位置TextComponent.setText(java.lang.String), replaceRange(java.lang.String, int, int), append(java.lang.String)@Deprecated public void insertText(String str, int pos)
insert(String, int) に置き換えられています。public void append(String str)
null や整合性のないパラメータを渡すことは無効であり、指定されていない動作の原因になることに注意してください。
str - 追加する null 以外のテキストinsert(java.lang.String, int)@Deprecated public void appendText(String str)
append(String) に置き換えられています。public void replaceRange(String str, int start, int end)
null や整合性のないパラメータを渡すことは無効であり、指定されていない動作の原因になることに注意してください。
str - 置き換えに使用する null 以外のテキストstart - 始点end - 終点insert(java.lang.String, int)@Deprecated public void replaceText(String str, int start, int end)
replaceRange(String, int, int) に置き換えられています。public int getRows()
setRows(int), getColumns()public void setRows(int rows)
rows - 行の数IllegalArgumentException - rows に指定された値が 0 より小さい場合getRows(), setColumns(int)public int getColumns()
setColumns(int), getRows()public void setColumns(int columns)
columns - 列の数IllegalArgumentException - columns に指定された値が 0 より小さい場合getColumns(), setRows(int)public int getScrollbarVisibility()
TextArea クラスは、どのスクロールバーが利用可能かを指定するために使用される 4 つの整数型定数を定義します。TextArea は、アプリケーションにスクロールバーの選択を与える 1 つのコンストラクタを持ちます。
SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, TextArea(java.lang.String, int, int, int)public Dimension getPreferredSize(int rows, int columns)
rows - 行の数columns - 列の数Component.getPreferredSize()@Deprecated public Dimension preferredSize(int rows, int columns)
getPreferredSize(int, int) に置き換えられています。public Dimension getPreferredSize()
getPreferredSize、クラス: ComponentComponent.getPreferredSize()@Deprecated public Dimension preferredSize()
getPreferredSize() に置き換えられています。preferredSize、クラス: Componentpublic Dimension getMinimumSize(int rows, int columns)
rows - 行の数columns - 列の数Component.getMinimumSize()@Deprecated public Dimension minimumSize(int rows, int columns)
getMinimumSize(int, int) に置き換えられています。public Dimension getMinimumSize()
getMinimumSize、クラス: ComponentComponent.getPreferredSize()@Deprecated public Dimension minimumSize()
getMinimumSize() に置き換えられています。minimumSize、クラス: Componentprotected String paramString()
TextArea の状態を表す文字列を返します。このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。返される文字列は空の場合がありますが、null にはなりません。paramString、クラス: TextComponentpublic AccessibleContext getAccessibleContext()
TextArea に関連付けられた AccessibleContext を返します。テキスト領域の場合、AccessibleContext は AccessibleAWTTextArea の形式を取ります。必要に応じて、新しい AccessibleAWTTextArea インスタンスが作成されます。getAccessibleContext、インタフェース: AccessiblegetAccessibleContext、クラス: TextComponentTextArea の AccessibleContext として機能する AccessibleAWTTextArea バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.