public class Demo03 extends JFrame {
public static void main(String[] args) {
new Demo03();
}
public Demo03() {
Container container = this.getContentPane();
JTextField textField = new JTextField("hello");
JTextField textField1 = new JTextField("world",20);
container.add(textField,BorderLayout.NORTH);
container.add(textField1,BorderLayout.SOUTH);
this.setVisible(true);
this.setSize(500,350);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}
public class Demo04 extends JFrame {
public static void main(String[] args) {
new Demo04();
}
public Demo04() {
Container container = this.getContentPane();
JPasswordField passwordField = new JPasswordField();
passwordField.setEchoChar('*');
container.add(passwordField);
this.setVisible(true);
this.setSize(500,350);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}