zoukankan      html  css  js  c++  java
  • 窗口程序

    package LL;
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class CK {
    public static class work implements ActionListener {
    JFrame f;
    JPanel p,p1;
    JButton b,b1;
    JLabel l,l1,l2;
    JTextField t;
    JPasswordField s;
    public work() {
    f = new JFrame("QQ");
    p = new JPanel();
    p1 = new JPanel();
    b = new JButton("注册:");
    b1 = new JButton("登录:");
    b1.setForeground(Color.GREEN);
    t = new JTextField();
    s = new JPasswordField();
    t.setBounds(110,82,200,28);
    s.setBounds(110,140,200,28);
    p.setLayout( null );
    p1.setLayout(null);
    b.setBounds(90, 210, 80, 25);
    b1.setBounds(240, 210, 80, 25);
    b.addActionListener(this);
    b1.addActionListener(this);
    l = new JLabel("账号:");
    l1 = new JLabel("密码:");
    l2 = new JLabel("登录成功!");
    l2.setBounds(130, 15, 150, 60);
    l.setBounds(75, 80, 80, 30);
    l1.setBounds(75, 140, 80, 30);
    p.add(b);
    p.add(b1);
    p.add(l);
    p.add(l1);
    p.add(t);
    p.add(s);
    p.setBackground(new Color(240,248,255));
    p1.add(l2);
    f.add(p);
    f.setLocation(430,198);
    f.setVisible(true);
    f.setSize(435, 324);
    b1.setFont(new Font("仿宋", Font.BOLD, 13));
    b.setFont(new Font("仿宋", Font.BOLD, 13));
    }
    public static void main(String args[]) {
    new work();
    }
    
    public void actionPerformed(ActionEvent e) {
    f.setVisible(false);
    JFrame f1 = new JFrame("QQ");
    f1.setVisible(true);
    f1.add(p1);
    p1.add(l2);
    f1.setLocation(430,198);
    f1.setSize(450,180);
    p1.setBackground(new Color(230,230,250));
    }
    }
    }

  • 相关阅读:
    线程安全和非线程安全
    spring MVC和hibernate的结合
    Spring学习笔记1——基础知识 (转)
    bitset && Luogu 3674 小清新人渣的本愿
    luogu P3452 [POI2007]BIU-Offices
    每日刷题记录
    Codeforces Round #721 (Div. 2) B2. Palindrome Game (hard version)
    2019湘潭邀请赛A
    2021CCPC浙江省赛 B
    Codeforces Round #720 (Div. 2) D
  • 原文地址:https://www.cnblogs.com/luli1220/p/10850470.html
Copyright © 2011-2022 走看看