举例来说,我想从JTextField中取值。在JFrame中,我可以用一个简单的txtField.getText()来做到这一点,但是我如何通过参数传递JFrame呢? static boolean validateFields(Webcrawler wc) {
try {
//I created the txtUrl in the original JFrame, I ca
我必须限制JTextField中的字符数。我用下面的代码来做到这一点,但问题是我使用虚拟键盘将数据提供给JTextField。所以偏移量始终设置为0。当我输入超过指定数量的字符时,它将重置字段并从头开始执行。例如,如果我的限制是3个字符,并且我输入xyz0,那么我的有限文本框会将字符读取到z,然后清除该字段并再次重新启动。所以我在现场留下了0。代码如下。 public class JTextFie
公共类FormattedName延伸javax.swing.JFrame中的{ /** Creates new form FormattedName */
public FormattedName() {
initComponents();
}
/** This method is called from within the constructor to
* initiali