zoukankan      html  css  js  c++  java
  • java中窗体的转化

    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    import javax.swing.*;
    
    public class AA implements ActionListener{
        JFrame f;
        JPanel p;
        JButton b;
        JLabel l;
        JTextField t1;
        JTextField t2;
        public AA(){
            f = new JFrame();
            p = new JPanel();
            l = new JLabel();
            t1 = new JTextField(10);
            t2 = new JTextField(10);
            b = new JButton("账号:");
            p.add(b);
            p.add(t1);
            b = new JButton("密码:");
            p.add(b);
            p.add(t2);
            b = new JButton("登录");
            f.add(p);
            p.add(b);
            f.setSize(450,400);
            b.addActionListener(this);
            f.setVisible(true);
            
        }
    
        public static void main(String[] args) {
            // TODO 自动生成的方法存根
            new AA();
        }
    
        @Override
        public void actionPerformed(ActionEvent arg0) {
            // TODO 自动生成的方法存根
            f.setVisible(false);
            JFrame f1;
            JPanel p1;
            JButton b1;
            f1 = new JFrame();
            p1 = new JPanel();
            b1 = new JButton("登录成功");
            f1.add(p1);
            p1.add(b1);
            f1.setSize(400, 400);
            p1.setBackground(Color.pink);
            f1.setVisible(true);
            
            
        }
    
    }
  • 相关阅读:
    JavaScript 之 变量
    SqlServer 之 系统视图
    SQL Server 2008中的Hints(提示)的简单整理
    SqlServer日常积累(三)
    Asp.net 之页面处理积累(一)
    Android 之Toast
    Android 之开发积累
    go与json
    binder
    DBUS
  • 原文地址:https://www.cnblogs.com/lvzhiqi/p/10872796.html
Copyright © 2011-2022 走看看