TextField
public TextField(String text,
int columns)
throws HeadlessException
Constructs a new text field initialized with the specified text to be displayed, and wide enough to hold the specified number of columns. A column is an approximate average character width that is platform-dependent. Parameters:
text - the text to be displayed. If text is null, the empty string "" will be displayed.
columns - the number of columns. If columns is less than 0, columns is set to 0.
Throws:
HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
See Also:
GraphicsEnvironment.isHeadless()
public TextField(String text,
int columns)
throws HeadlessException
Constructs a new text field initialized with the specified text to be displayed, and wide enough to hold the specified number of columns. A column is an approximate average character width that is platform-dependent. Parameters:
text - the text to be displayed. If text is null, the empty string "" will be displayed.
columns - the number of columns. If columns is less than 0, columns is set to 0.
Throws:
HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
See Also:
GraphicsEnvironment.isHeadless()
java.awt.TextField()
java.awt.TextField(int)
java.awt.TextField(java.lang.String)
java.awt.TextField(java.lang.String, int) 我只发现这些,你的那个是如何搞成的??
Java.awt.TextField没有这个构造函数啊~那就是你自己写的类了~ TextField("Buy:", "", 3, TextField.NUMERIC);
如果这个类是我写的,他的意思就是 构造一个TextField,前面有一个JLabel写着"Buy:",然后这个TextField里面的初始值为"",然后这个TextField只接受数字,并且长度不得大于3。这就是我的构造函数了~