[英]JTextField simply doesn't respond
I have gone through the other question with same title but that isn't much helpful. 我经历了另一个标题相同的问题,但这并没有太大帮助。 I am using GridBagLayout to build a form.
我正在使用GridBagLayout构建表单。 But the JTextFields in my form simply doesn't respond.
但是我表单中的JTextFields根本不响应。 I click in it but it doesn't show the cursor.
我单击它,但没有显示光标。 Thus i cant enter anything in it.
因此,我无法在其中输入任何内容。 Code snippet is as follows:
程式码片段如下:
//textfields
weighttf = new JTextField(20);
go = new JButton("Get my Ideal Weight");
go.setFont(centerpanelfont);
centerpanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.weightx=0.5;
c.weighty=0.5;
c.gridx=0;
c.gridy=1;
centerpanel.add(weighttf,c);
尝试使文本字段可编辑
weighttf.setEditable(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.