DocumentListener 对应的是 JTextField
什么是对JPasswordField 的啊? 我用DocumentListener 在JPasswordField 结果没有星
JPasswordField
答案:1 悬赏:50 手机版
解决时间 2021-02-27 10:08
- 提问者网友:咪咪
- 2021-02-26 15:37
最佳答案
- 五星知识达人网友:西岸风
- 2021-02-26 16:18
楼主可以试试这样啊.
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import java.awt.Rectangle;
public class Frame1 extends JFrame {
JPanel contentPane;
JPasswordField jPasswordField1 = new JPasswordField();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setSize(new Dimension(400, 300));
setTitle("Frame Title");
jPasswordField1.setText("jPasswordField1");
jPasswordField1.setBounds(new Rectangle(136, 165, 127, 24));
contentPane.add(jPasswordField1);
}
}
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import java.awt.Rectangle;
public class Frame1 extends JFrame {
JPanel contentPane;
JPasswordField jPasswordField1 = new JPasswordField();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setSize(new Dimension(400, 300));
setTitle("Frame Title");
jPasswordField1.setText("jPasswordField1");
jPasswordField1.setBounds(new Rectangle(136, 165, 127, 24));
contentPane.add(jPasswordField1);
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯