📄 textarea.java
字号:
this.rows = rows;
// FIXME: How to we communicate this to our peer?
}
/*************************************************************************/
/**
* Returns the minimum size for this text field.
*
* @return The minimum size for this text field.
*/
public Dimension getMinimumSize() {
return (getMinimumSize(getRows(), getColumns()));
}
/*************************************************************************/
/**
* Returns the minimum size of a text field with the specified number
* of rows and columns.
*
* @param rows The number of rows to get the minimum size for.
* @param columns The number of columns to get the minimum size for.
*/
public Dimension getMinimumSize(int rows, int columns) {
TextAreaPeer tap = (TextAreaPeer) getPeer();
if (tap == null)
return (null); // FIXME: What do we do if there is no peer?
return (tap.getMinimumSize(rows, columns));
}
/*************************************************************************/
/**
* Returns the minimum size for this text field.
*
* @return The minimum size for this text field.
*
* @deprecated This method is depcreated in favor of
* <code>getMinimumSize()</code>.
*/
public Dimension minimumSize() {
return (getMinimumSize(getRows(), getColumns()));
}
/*************************************************************************/
/**
* Returns the minimum size of a text field with the specified number
* of rows and columns.
*
* @param rows The number of rows to get the minimum size for.
* @param columns The number of columns to get the minimum size for.
*
* @deprecated This method is deprecated in favor of
* <code>getMinimumSize(int)</code>.
*/
public Dimension minimumSize(int rows, int columns) {
return (getMinimumSize(rows, columns));
}
/*************************************************************************/
/**
* Returns the preferred size for this text field.
*
* @return The preferred size for this text field.
*/
public Dimension getPreferredSize() {
return (getPreferredSize(getRows(), getColumns()));
}
/*************************************************************************/
/**
* Returns the preferred size of a text field with the specified number
* of rows and columns.
*
* @param rows The number of rows to get the preferred size for.
* @param columns The number of columns to get the preferred size for.
*/
public Dimension getPreferredSize(int rows, int columns) {
TextAreaPeer tap = (TextAreaPeer) getPeer();
if (tap == null)
return (null); // FIXME: What do we do if there is no peer?
return (tap.getPreferredSize(rows, columns));
}
/*************************************************************************/
/**
* Returns the preferred size for this text field.
*
* @return The preferred size for this text field.
*
* @deprecated This method is deprecated in favor of
* <code>getPreferredSize()</code>.
*/
public Dimension preferredSize() {
return (getPreferredSize(getRows(), getColumns()));
}
/*************************************************************************/
/**
* Returns the preferred size of a text field with the specified number
* of rows and columns.
*
* @param rows The number of rows to get the preferred size for.
* @param columns The number of columns to get the preferred size for.
*
* @deprecated This method is deprecated in favor of
* <code>getPreferredSize(int)</code>.
*/
public Dimension preferredSize(int columns) {
return (getPreferredSize(rows, columns));
}
/*************************************************************************/
/**
* Returns one of the constants from this class indicating which
* types of scrollbars this object uses, if any.
*
* @return The scrollbar type constant for this object.
*/
public int getScrollbarVisibility() {
return (scrollbarVisibility);
}
/*************************************************************************/
/**
* Notify this object that it should create its native peer.
*/
public void addNotify() {
if (getPeer() != null)
return;
setPeer((ComponentPeer) getToolkit().createTextArea(this));
}
/*************************************************************************/
/**
* Appends the specified text to the end of the current text.
*
* @param text The text to append.
*/
public void append(String str) {
TextAreaPeer tap = (TextAreaPeer) getPeer();
if (tap == null)
return;
tap.insert(str, tap.getText().length());
}
/*************************************************************************/
/**
* Appends the specified text to the end of the current text.
*
* @param text The text to append.
*
* @deprecated This method is deprecated in favor of
* <code>append()</code>.
*/
public void appendText(String text) {
append(text);
}
/*************************************************************************/
/**
* Inserts the specified text at the specified location.
*
* @param text The text to insert.
* @param pos The insert position.
*/
public void insert(String text, int pos) {
TextAreaPeer tap = (TextAreaPeer) getPeer();
if (tap == null)
return;
tap.insert(text, pos);
}
/*************************************************************************/
/**
* Inserts the specified text at the specified location.
*
* @param text The text to insert.
* @param pos The insert position.
*
* @deprecated This method is depcreated in favor of <code>insert()</code>.
*/
public void insertText(String text, int pos) {
insert(text, pos);
}
/*************************************************************************/
/**
* Replaces the text bounded by the specified start and end positions
* with the specified text.
*
* @param text The new text for the range.
* @param start The start position of the replacement range.
* @param end The end position of the replacement range.
*/
public void replaceRange(String text, int start, int end) {
TextAreaPeer tap = (TextAreaPeer) getPeer();
if (tap == null)
return;
tap.replaceRange(text, start, end);
}
/*************************************************************************/
/**
* Replaces the text bounded by the specified start and end positions
* with the specified text.
*
* @param text The new text for the range.
* @param start The start position of the replacement range.
* @param end The end position of the replacement range.
*
* @deprecated This method is deprecated in favor of
* <code>replaceRange()</code>.
*/
public void replaceText(String text, int start, int end) {
replaceRange(text, start, end);
}
/*************************************************************************/
/**
* Returns a debugging string for this text area.
*
* @return A debugging string for this text area.
*/
protected String paramString() {
return (getClass().getName() + "(rows=" + getRows() + ",columns=" + getColumns() + ",scrollbars=" + getScrollbarVisibility() + ")");
}
} // class TextArea
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -