zoukankan      html  css  js  c++  java
  • 7

    
    

    1、运用事件处理相关知识,完成两个窗口之间的切换,例如:登陆窗口------》注册窗口

    2、对本次作业进行总结,在编程过程中遇到哪些问题,如何解决,有哪些收获?




    package
    Laaaa; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Dccc implements ActionListener { JFrame f1,f2; JPanel p1,p2; JButton b1,b2; JLabel l1,l2,l3; JTextField t1,t2;//文本框 public Dccc() { f1=new JFrame("LYX"); f2=new JFrame("LYX"); p1=new JPanel(); p2=new JPanel(); p1.setLayout(null);//流布局 p2.setLayout(null); b1=new JButton("注册"); b2=new JButton("登录"); l1=new JLabel("账户"); l1.setFont(new Font("楷体",Font.BOLD,18));//自定义标签字体 l2=new JLabel("密码"); l2.setFont(new Font("楷体",Font.BOLD,18)); l3=new JLabel("登录成功!"); l3.setForeground(Color.red); t1=new JTextField(); t2=new JTextField(); b1.addActionListener(this); b2.addActionListener(this); f1.add(p1); p1.add(b1); p1.add(b2); p1.add(l1); p1.add(l2); p1.add(t1); p1.add(t2); b1.setBounds(150,150,60,40); b2.setBounds(270,150,60,40); l1.setBounds(80,50,40,30); l2.setBounds(80,100,40,30); t1.setBounds(120,50,300,30); t2.setBounds(120,100,300,30); f1.setVisible(true); f1.setSize(500,300); } public static void main(String[] args) { new Dccc(); } public void actionPerformed(ActionEvent e) { f1.setVisible(false); p2.setBackground(new Color(211,252,4));//自定义面板颜色 f2.setVisible(true); f2.add(p2); p2.add(l3); l3.setBounds(225,75,150,60); f2.setLocation(600,0); f2.setSize(500,300); } }

     本次上机很复杂,很难,我没有写完。。。

  • 相关阅读:
    uiwebview与objective-c
    ios开发:如何用js调用ios
    ios上ZXing库的配置流程
    IOS连接
    ios开发:如何加载大量图片 相册示例
    ASIHTTPRequest中文入门教程全集 http://www.zpluz.com/thread-3284-1-1.html
    Error message Object BOM does not allow filter on MAST.STLNR
    How to download sales BOM from ERP to CRM
    CRM中间件里parent not ok的错误消息如何处理
    SAP CRM settype的重要性
  • 原文地址:https://www.cnblogs.com/luli1220/p/10871444.html
Copyright © 2011-2022 走看看