1 package Layout; 2 import java.awt.*; 3 import javax.swing.*; 4 public class LoginInterface extends JFrame{ 5 private ImageIcon photo = new ImageIcon("photo/psb.jpg"); 6 private JLabel l1 = new JLabel(photo); 7 private JLabel l2 = new JLabel("QQ号码",JLabel.CENTER); 8 private JLabel l3 = new JLabel("QQ密码",JLabel.CENTER); 9 private JLabel l4 = new JLabel("忘记密码",JLabel.CENTER); 10 private JLabel l5 = new JLabel("<html><ahref=‘www.qq.com‘>申请密码保护</a>",JLabel.CENTER); 11 private JPanel center1 = new JPanel();//普通用户 12 private JPanel center2 = new JPanel();//会员 13 private JPanel center3 = new JPanel();//管理员 14 private JPanel south = new JPanel(); 15 private JTabbedPane xxk = new JTabbedPane();//选项卡 16 17 //private JButton b1 = new JButton(new ImageIcon("photo/psb.jpg")); 18 private JButton b1 = new JButton("清除号码"); 19 private JButton b2 = new JButton("登 录"); 20 private JButton b3 = new JButton("取 消"); 21 private JButton b4 = new JButton("向 导"); 22 private JTextField num = new JTextField(10); 23 private JPasswordField password = new JPasswordField(10); 24 private JCheckBox c1 = new JCheckBox("隐身登录"); 25 private JCheckBox c2 = new JCheckBox("记住密码"); 26 27 public LoginInterface(){ 28 center1.setLayout(new GridLayout(3,3)); 29 l4.setFont(new Font("宋体",Font.PLAIN,16));//字体 30 l4.setForeground(Color.blue);// 颜色 31 l5.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));// 标签设置网址 32 center2.setBackground(Color.blue);center3.setBackground(Color.black); 33 xxk.add("普通用户", center1);xxk.add("会员",center2);xxk.add("管理员",center3); 34 center1.add(l2);center1.add(num);center1.add(b1); 35 center1.add(l3);center1.add(password);center1.add(l4); 36 center1.add(c1);center1.add(c2);center1.add(l5); 37 //b2.setPreferredSize(new Dimension(20, 10)); 38 //b3.setPreferredSize(new Dimension(20, 10)); 39 //b4.setPreferredSize(new Dimension(20, 10)); 40 south.add(b2);south.add(b3);south.add(b4); 41 this.add(l1,BorderLayout.NORTH); 42 this.add(xxk,BorderLayout.CENTER); 43 this.add(south,BorderLayout.SOUTH); 44 this.setTitle("登录界面"); 45 this.setSize(1000, 1000); 46 this.setLocation(100,100); 47 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 48 this.pack();// 窗口紧促排列 49 this.setResizable(false); 50 this.setVisible(true); 51 } 52 public static void main(String[] args) { 53 LoginInterface l = new LoginInterface(); 54 55 } 56 57 }
时间: 2024-11-09 01:17:52