📄 defineedittext.java
字号:
}
/**
* Returns the left text margin in twips (i.e. 1/20 px). Check with
* <code>hasLayout()</code> first if value is set.
*
* @return left margin in twips
*/
public int getLeftMargin() {
return leftMargin;
}
/**
* Restricts the text length to the specified amount of characters.
*
* @param maxLength maximum text length
*/
public void setMaxLength(int maxLength) {
this.maxLength = maxLength;
hasMaxLength = true;
}
/**
* Returns the maximum length of the text. Check with
* <code>hasMaxLength()</code> if value is set.
*
* @return maximum text length
*/
public int getMaxLength() {
return maxLength;
}
/**
* Sets the value of the <code>multiLine</code> flag. If set, the text
* field may contain more than one text line.
*
* @param multiline <code>true</code> if flag set, else <code>false</code>
*/
public void setMultiline(boolean multiline) {
this.multiline = multiline;
}
/**
* Checks if the <code>multiLine</code> flag is set. If set, the text field
* may contain more than one text line.
*
* @return <code>true</code> if <code>multiLine</code> flag set, otherwise
* <code>false</code>
*/
public boolean isMultiline() {
return multiline;
}
/**
* Sets the value of the <code>noSelect</code> flag. If set, the text
* cannot be interactively selected (and copied).
*
* @param noSelect <code>true</code> if flag set, else <code>false</code>
*/
public void setNoSelect(boolean noSelect) {
this.noSelect = noSelect;
}
/**
* Checks if the <code>noSelect</code> flag is set. If set, the text cannot
* be interactively selected (and copied).
*
* @return <code>true</code> if <code>noSelect</code> flag set, otherwise
* <code>false</code>
*/
public boolean isNoSelect() {
return noSelect;
}
/**
* Sets the value of the <code>password</code> flag. If set, the characters
* of the text are displayed as asterisks.
*
* @param password <code>true</code> if flag set, else <code>false</code>
*/
public void setPassword(boolean password) {
this.password = password;
}
/**
* Checks whether the <code>password</code> flag is set. If set, the
* characters of the text are displayed as asterisks.
*
* @return <code>true</code> if <code>password</code> flag set, otherwise
* <code>false</code>
*/
public boolean isPassword() {
return password;
}
/**
* Specifies the value of the <code>readOnly</code> flag. If set, the text
* cannot be interactively edited.
*
* @param readOnly <code>true</code> if flag set, else <code>false</code>
*/
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
/**
* Checks whether the <code>readOnly</code> flag is set. If set, the text
* cannot be interactively edited.
*
* @return <code>true</code> if <code>readOnly</code> flag set, otherwise
* <code>false</code>
*/
public boolean isReadOnly() {
return readOnly;
}
/**
* Returns the right text margin in twips (i.e. 1/20 px). Check with
* <code>hasLayout()</code> first if value is set.
*
* @return right margin in twips
*/
public int getRightMargin() {
return rightMargin;
}
/**
* Sets the text color to the specified color. Alpha channel (transparency)
* information can also be specified.
*
* @param textColor text color as RGBA value
*/
public void setTextColor(RGBA textColor) {
this.textColor = textColor;
hasTextColor = true;
}
/**
* Returns the text color and transparency value.
*
* @return text color as RGBA value
*/
public RGBA getTextColor() {
return textColor;
}
/**
* Sets the value of the <code>useOutlines</code> flag. If set, the Flash
* Player tries to use device fonts rather than glyph fonts.
*
* @param useOutlines <code>true</code> if flag set, else
* <code>false</code>
*/
public void setUseOutlines(boolean useOutlines) {
this.useOutlines = useOutlines;
}
/**
* Checks if the <code>useOutlines</code> flag is set. If set, the Flash
* Player tries to use device fonts rather than glyph fonts.
*
* @return <code>true</code> if <code>useOutlines</code> flag set,
* otherwise <code>false</code>
*/
public boolean isUseOutlines() {
return useOutlines;
}
/**
* Sets the name of the variable the contents of the text field are stored
* in and kept in sync with.
*
* @param variableName variable name (in dot or slash syntax)
*/
public void setVariableName(String variableName) {
this.variableName = variableName;
}
/**
* Returns the name of the variable the contents of the text field are
* stored in and kept in sync with.
*
* @return variable name (in dot or slash syntax)
*/
public String getVariableName() {
return variableName;
}
/**
* Sets the value of the <code>wordWrap</code> flag. If set, the text will
* wrap at the end of the line.
*
* @param wordWrap <code>true</code> if flag set, else <code>false</code>
*/
public void setWordWrap(boolean wordWrap) {
this.wordWrap = wordWrap;
}
/**
* Checks if the <code>wordWrap</code> flag is set. If set, the text will
* wrap at the end of the line.
*
* @return <code>true</code> if <code>wordWrap</code> flag set, otherwise
* <code>false</code>
*/
public boolean isWordWrap() {
return wordWrap;
}
/**
* Checks whether the text font (ID and size) has been specified.
*
* @return <code>true</code> if font specified, else <code>false</code>
*/
public boolean hasFont() {
return hasFont;
}
/**
* Checks if the text layout has been specified, i.e. if the following
* attributes have been set:
*
* <ul>
* <li>
* align
* </li>
* <li>
* left margin
* </li>
* <li>
* right margin
* </li>
* <li>
* indent
* </li>
* <li>
* leading
* </li>
* </ul>
*
*
* @return <code>true</code> if at least one layout attribute set
*/
public boolean hasLayout() {
return hasLayout;
}
/**
* Checks if the length of the text has been restricted to a maximum value.
*
* @return <code>true</code> if maximum text length is set, else
* <code>false</code>
*/
public boolean hasMaxLength() {
return hasMaxLength;
}
/**
* Checks if an initial text is provided.
*
* @return <code>true</code> if initial text set, else <code>false</code>
*/
public boolean hasText() {
return hasText;
}
/**
* Checks if the text color is set.
*
* @return <code>true</code> if text color set, else <code>false</code>
*/
public boolean hasTextColor() {
return hasTextColor;
}
protected void writeData(OutputBitStream outStream)
throws IOException {
outStream.writeUI16(characterId);
bounds.write(outStream);
outStream.writeBooleanBit(hasText);
outStream.writeBooleanBit(wordWrap);
outStream.writeBooleanBit(multiline);
outStream.writeBooleanBit(password);
outStream.writeBooleanBit(readOnly);
outStream.writeBooleanBit(hasTextColor);
outStream.writeBooleanBit(hasMaxLength);
outStream.writeBooleanBit(hasFont);
outStream.writeUnsignedBits(0, 1); // 1 reserved bit
outStream.writeBooleanBit(autoSize);
outStream.writeBooleanBit(hasLayout);
outStream.writeBooleanBit(noSelect);
outStream.writeBooleanBit(border);
outStream.writeUnsignedBits(0, 1); // 1 reserved bit
outStream.writeBooleanBit(html);
outStream.writeBooleanBit(useOutlines);
if (hasFont) {
outStream.writeUI16(fontId);
outStream.writeUI16(fontHeight);
}
if (hasTextColor) {
textColor.write(outStream);
}
if (hasMaxLength) {
outStream.writeUI16(maxLength);
}
if (hasLayout) {
outStream.writeUI8(align);
outStream.writeUI16(leftMargin);
outStream.writeUI16(rightMargin);
outStream.writeUI16(indent);
outStream.writeUI16(leading);
}
if (variableName != null) {
outStream.writeString(variableName);
} else {
outStream.writeString("");
}
if (hasText) {
outStream.writeString(initialText);
}
}
void setData(byte[] data) throws IOException {
InputBitStream inStream = new InputBitStream(data);
if (getSWFVersion() < 6) {
if (isJapanese()) {
inStream.setShiftJIS(true);
} else {
inStream.setANSI(true);
}
}
characterId = inStream.readUI16();
bounds = new Rect(inStream);
hasText = inStream.readBooleanBit();
wordWrap = inStream.readBooleanBit();
multiline = inStream.readBooleanBit();
password = inStream.readBooleanBit();
readOnly = inStream.readBooleanBit();
hasTextColor = inStream.readBooleanBit();
hasMaxLength = inStream.readBooleanBit();
hasFont = inStream.readBooleanBit();
inStream.readBooleanBit(); // ignore reserved bit
autoSize = inStream.readBooleanBit();
hasLayout = inStream.readBooleanBit();
noSelect = inStream.readBooleanBit();
border = inStream.readBooleanBit();
inStream.readBooleanBit(); // ignore reserved bit
html = inStream.readBooleanBit();
useOutlines = inStream.readBooleanBit();
if (hasFont) {
fontId = inStream.readUI16();
fontHeight = inStream.readUI16();
}
if (hasTextColor) {
textColor = new RGBA(inStream);
}
if (hasMaxLength) {
maxLength = inStream.readUI16();
}
if (hasLayout) {
align = inStream.readUI8();
leftMargin = inStream.readUI16();
rightMargin = inStream.readUI16();
indent = inStream.readUI16();
leading = inStream.readUI16();
}
variableName = inStream.readString();
if (hasText) {
initialText = inStream.readString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -