//youxiang.javaimpackagelianxi;importjava.awt.EventQueue;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.border.EmptyBorder;importjavax.swing.JLabel;i...
//youxiang.java
impackage lianxi;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPasswordField;
import javax.swing.JButton;
public class Login extends JFrame {
private JPanel contentPane;
private JTextField textField;
private JPasswordField passwordField;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login frame = new Login();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Login() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
JLabel label = new JLabel("\u90AE\u7BB1");
contentPane.add(label);
textField = new JTextField();
textField.setText("\u7528\u6237\u540D");
contentPane.add(textField);
textField.setColumns(20);
JLabel label_1 = new JLabel("@");
contentPane.add(label_1);
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"263.net", "qq.com", "sina.com"}));
contentPane.add(comboBox);
JLabel label_2 = new JLabel("\u5BC6\u7801");
contentPane.add(label_2);
passwordField = new JPasswordField();
passwordField.setColumns(20);
contentPane.add(passwordField);
JButton button = new JButton("\u767B\u9646");
contentPane.add(button);
pack();
}
}
展开