?? mydocument.java
字號:
/**
* @(#)MyDocument.java
* @A document used to limiting the length of the input text.
*
* @Link Scholes
* @version 1.00 2008/7/21
*/
package GUI;
//Java extension packages
import javax.swing.text.*;
public class MyDocument extends PlainDocument
{
private int length;
//construct a document with specified length limit of the input text
public MyDocument(int n)
{
super();
length = n;
}
//limit the input
public void insertString(int offs,String str,AttributeSet a) throws BadLocationException
{
if(getLength() + str.length() < length + 1)
{
super.insertString(offs,str,a);
}
}
} //end class MyDocument
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -