• 期末设计(第十三周)


    1、QQ登录界面
    界面设计人:程雯
    代码:
    package com.qq;
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.Image;

    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;

    public class LoginFrame {

    private JFrame frm;
    private JTextField username;
    private JPasswordField password;
    private JLabel yonghuming;
    private JLabel mima;
    private JLabel lb1;
    private JLabel register;
    private JLabel lookpsw;
    private JCheckBox remeber_JCheckBox;
    private JCheckBox auto_JCheckBox;
    private JButton loginbtn;
    private ImageIcon bg;
    
    public LoginFrame() {
    
    	frm = new JFrame();
    	frm.setLayout(null);
    
    	yonghuming = new JLabel("账号");
    	yonghuming.setBounds(150, 115, 100, 40);
    	frm.add(yonghuming);
    	mima = new JLabel("密码");
    	mima.setBounds(150, 140, 100, 40);
    	frm.add(mima);
    
    	username = new JTextField(10);
    	username.setBounds(190, 125, 100, 20);
    	frm.add(username);
    
    	password = new JPasswordField(10);
    	password.setBounds(190, 150, 100, 20);
    	frm.add(password);
    
    	register = new JLabel("注册账号");
    	register.setBounds(300, 113, 100, 40);
    	frm.add(register);
    
    	lookpsw = new JLabel("找回密码");
    	lookpsw.setBounds(300, 140, 100, 40);
    	frm.add(lookpsw);
    
    	remeber_JCheckBox = new JCheckBox("记住密码");
    	remeber_JCheckBox.setBounds(160, 180, 100, 40);
    	frm.add(remeber_JCheckBox);
    
    	auto_JCheckBox = new JCheckBox("自动登陆");
    	auto_JCheckBox.setBounds(280, 180, 100, 40);
    	frm.add(auto_JCheckBox);
    	remeber_JCheckBox.setOpaque(false);
    	auto_JCheckBox.setOpaque(false);
    
    	loginbtn = new JButton("安全登陆");
    	loginbtn.setBounds(190, 225, 100, 30);
    	frm.add(loginbtn);
    
    	
    	ImageIcon image1 = new ImageIcon("icon\北部背景01.png");
    	image1.setImage(image1.getImage().getScaledInstance(520, 138, Image.SCALE_DEFAULT));
    	JLabel label1 = new JLabel(image1);
    	label1.setBounds(-40, -75, 500, 250);
    	
    	ImageIcon image = new ImageIcon("icon\头像.jpg");
    	image.setImage(image.getImage().getScaledInstance(80, 80, Image.SCALE_DEFAULT));
    	JLabel label = new JLabel(image);
    	label.setBounds(-20, 65, 200, 200);
    	
    	frm.add(label);
    	frm.add(label1);
    
    	frm.setBounds(130, 60, 60, 30);
    
    	frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	frm.setBounds(700, 200, 470, 350);
    	frm.setVisible(true);
    }
    
    public static void main(String[] args) {
    	new LoginFrame();
    }
    

    }
    package com.qq;

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import java.awt.Image;
    import java.io.File;

    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;

    public class MainLogin {

    private JFrame frm;
    private JTextField username;
    private JPasswordField password;
    private JLabel register;
    private JLabel  lookpsw;
    private JCheckBox remeber_JCheckBox;
    private JCheckBox auto_JCheckBox;
    private JButton login;
    private JPanel center_JPanel;
    private JPanel south_JPanel;
    private JPanel north_JPanel;
    private JLabel a;
    private JLabel  b;
    private JLabel c;
    private JLabel d;
    
    public MainLogin(){
    	
            frm = new  JFrame();
      
    
    	
             // 北部布局
      
              north_JPanel = new JPanel();
             
              
              
            
    		
    		// 中间布局
    		center_JPanel = new JPanel(new GridLayout(3,3));
    
    		username = new JTextField();
    		
    		password = new JPasswordField(10);
    		
    		
    		register = new JLabel("注册账号");
    		
    		lookpsw = new JLabel("找回密码");
    		
    		b =new JLabel();
    		c =new JLabel();
    		d =new JLabel();
    		
    		remeber_JCheckBox = new JCheckBox("记住密码");
    		auto_JCheckBox = new JCheckBox("自动登陆");
    		
    		remeber_JCheckBox.setOpaque(false);
    		auto_JCheckBox.setOpaque(false);
    
    		center_JPanel.add(b);
    		center_JPanel.add(username);
    		center_JPanel.add(register);
    		
    		center_JPanel.add(c);
    		center_JPanel.add(password);
    		center_JPanel.add(lookpsw);
    		
    		center_JPanel.add(d);	
    		center_JPanel.add(remeber_JCheckBox);
    		center_JPanel.add(auto_JCheckBox);
    		
    		
    		// 南部布局
    		south_JPanel = new JPanel();		
    		login = new JButton("安全登录");
    		south_JPanel.add(login);
    		
    		// 添加面板到窗体
    		frm.add(north_JPanel, "North");
    		frm.add(center_JPanel, "Center");
    		frm.add(south_JPanel, "South");		
    		frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		frm.setBounds(700, 200, 500, 350);
    		frm.setVisible(true);
    }
    
     public static void main(String[] args){
    	 new MainLogin();
     }
    

    }

    程序运行图:

    2、好友列表界面
    界面设计人:辛奕宏
    代码:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.GridLayout;
    import java.awt.Image;
    import java.awt.Rectangle;
    import java.awt.Toolkit;
    import java.awt.event.ActionListener;

    import javax.swing.BorderFactory;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSplitPane;
    import javax.swing.JTextField;
    import javax.swing.JToolBar;
    import javax.swing.SwingConstants;

    public class HaoYou {
    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub

    	//创建窗体并设置标题(不使用布局)
    	JFrame frm = new JFrame("好友列表");
    	frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frm.setLayout(null);
       
        //添加彩色框作为头像
        JLabel a = new JLabel(" 头 像");
        a.setBounds(6,5,60,60);
        a.setFont(new Font("楷体",Font.BOLD,16));//设置字体楷体,粗体,16号字体
        a.setBackground(Color.pink);
        a.setOpaque(true);
        frm.add(a);
        
    	//添加头像图片
    

    // JLabel lb = new JLabel();
    // lb.setIcon( new ImageIcon("Img/1.png"));
    // frm.add(lb);
    // lb.setBounds(6,5,60,60);

        //创建组件并添加到窗体(添加个人昵称)		
    	JLabel a1=new JLabel("多喜欢你i");
    	a1.setBounds(75,5,90,60);
    	a1.setFont(new Font("楷体",Font.BOLD,15));//设置字体楷体,粗体,15号字体	
        frm.add(a1);
    	
    	//创建组合框
        String[]things={"在线","隐身","离开"};
        JComboBox comboBox=new  JComboBox(things);
        comboBox.setBounds(170,20,65,30);
        frm.add(comboBox);
    
    	//添加一个搜索文本框,可编辑左侧输入,45列,并设置起始位置与大小
    	JTextField userText = new JTextField();
    	userText.setEditable(true);
    	userText.setHorizontalAlignment(SwingConstants.LEFT);
    	userText.setColumns(45);
    	userText.setBounds(0,70,220,30);
    	frm.add(userText);
    	
    	//创建一个查找按钮
    	JButton loginBtn5 = new JButton("查找");
    	loginBtn5.setBounds(222,70,60,30);
    	frm.add(loginBtn5);
    
    	//添加标签——我的好友列表
    	JLabel a2=new JLabel("我的好友(1/2)");
    	a2.setBounds(20,100,80,50);
    	frm.add(a2);
    	//添加好友一的昵称
    	JLabel b1=new JLabel("佳佳i ");
    	b1.setBounds(75,130,60,80);
    	frm.add(b1);
    	//添加彩色框作为头像
        JLabel b = new JLabel(" 头 像");
        b.setBounds(5,140,60,60);
        b.setFont(new Font("楷体",Font.BOLD,16));//设置字体楷体,粗体,16号字体
        b.setBackground(Color.orange);
        b.setOpaque(true);
        frm.add(b);
    	
    	//添加好友二的昵称
    	JLabel b2=new JLabel("小朋友 ");
    	b2.setBounds(75,200,60,80);
    	frm.add(b2);
    	//添加彩色框作为头像
        JLabel c = new JLabel(" 头 像");
        c.setBounds(5,205,60,60);
        c.setFont(new Font("楷体",Font.BOLD,16));//设置字体楷体,粗体,16号字体
        c.setBackground(Color.lightGray);
        c.setOpaque(true);
        frm.add(c);
    	
        //添加标签——黑名单列表
    	JLabel a3=new JLabel("黑名单(1/1)");
    	a3.setBounds(20,250,80,70);
    	frm.add(a3);
    	//添加黑名单好友昵称
    	JLabel b3=new JLabel("大怪兽 ");
    	b3.setBounds(75,290,60,80);
    	frm.add(b3);
    	//添加彩色框作为头像
        JLabel d = new JLabel(" 头 像");
        d.setBounds(5,300,60,60);
        d.setFont(new Font("楷体",Font.BOLD,16));//设置字体楷体,粗体,16号字体
        d.setBackground(Color.lightGray);
        d.setOpaque(true);
        frm.add(d);
    	
        //添加按钮并设置起始位置与大小
    	JButton loginBtn1 = new JButton("菜单");
    	loginBtn1.setBounds(15,530,60,30);
    	frm.add(loginBtn1);
    	
    	JButton loginBtn2 = new JButton("设置");
    	loginBtn2.setBounds(80,530,60,30);
    	frm.add(loginBtn2);
    	
    	JButton loginBtn3 = new JButton("查找");
    	loginBtn3.setBounds(145,530,60,30);
    	frm.add(loginBtn3);
    
    	JButton loginBtn4 = new JButton("应用");
    	loginBtn4.setBounds(210,530,60,30);
    	frm.add(loginBtn4);
    	
    	frm.setBounds(30,80,300,620);
    	frm.setVisible(true);
    }
    
    private static void add(JLabel lb) {
    	// TODO Auto-generated method stub
    	
    }
    
    private static void setSize(int i, int j) {
    	// TODO Auto-generated method stub
    	
    }
    

    }
    程序运行图:

  • 相关阅读:
    Mac下tomcat的安装与配置
    jquery中的属性和css
    jquery中的选择器
    数组对象元素的添加,String对象,BOM对象以及文档对象的获取
    js中的函数,Date对象,Math对象和数组对象
    js中的循环语句
    js中的运算符和条件语句
    js中的数据类型及其转换
    js的意义,引用方法及变量
    移动端网页项目总结
  • 原文地址:https://www.cnblogs.com/mijx/p/5539061.html
Copyright © 2020-2023  润新知