THE THIRTY-THIRD DAY

    今天星期二,参加培训的第三十三天,让我想到了失恋33天,还挺有意思的,嗯,今天好像把进阶篇看完了,加快了一下速度,毕竟全都是swing,又出新的类库了,什么javafx,无所谓了,反正想要做个QQ,连个注册界面都做不好,真的是难。

    今天学了什么,好像是什么都没有学,弄个验证码,弄了半天,然后又弄些没有用的,又是半天,一天就过去了呗。

    也没有别的什么好说的了,毕竟真的是什么也没有弄出来,不过倒是买了三本书,还有把java 看完了,当然还有好多不懂的,不过也没有什么事了,知道有这么个东西就好了。

    然后就随便贴点代码吧:

今天的注册页,名字都写错了,也是很尴尬。

package view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSplitPane;
import javax.swing.JTextField;

import util.ImagePanelUtil;

public class LoginView extends JFrame {
    public LoginView() {
		// TODO Auto-generated constructor stub
    	setLayout(new BorderLayout());
    	JPanel leftPanel = new JPanel();
    	JPanel rightPanel = new JPanel();
    	JPanel centerPanel = new JPanel();
	    JLabel usernameLabel = new JLabel("请输入你昵称:");
	    JLabel passwordLabel = new JLabel("请输入密码:");
	    JLabel phoneNumberLabel = new JLabel("请输入手机号:");
	    leftPanel.setLayout(new BoxLayout(leftPanel,BoxLayout.Y_AXIS));
	    leftPanel.add(usernameLabel);
	    leftPanel.add(passwordLabel);
	    leftPanel.add(phoneNumberLabel);
	    JTextField usernameText = new JTextField(15);
	    JPasswordField passwordText = new JPasswordField(15);
	    JTextField phoneNumberText = new JTextField(12);
	    rightPanel.setLayout(new BoxLayout(rightPanel,BoxLayout.Y_AXIS));
	    rightPanel.add(usernameText);
	    rightPanel.add(passwordText);
	    rightPanel.add(phoneNumberText);
	    centerPanel.add(leftPanel);
	    centerPanel.add(rightPanel);
	    JPanel downPanel = new JPanel();
	    JButton jbtSure = new JButton("QQ注册");
	    downPanel.add(jbtSure,BorderLayout.CENTER);
	    JPanel mainPanel = new JPanel();
	    mainPanel.setLayout(new BorderLayout());
	    mainPanel.add(centerPanel, BorderLayout.CENTER);
	    mainPanel.add(downPanel, BorderLayout.SOUTH);
	    JPanel upPanel = new ImagePanelUtil(350,150,"./image/他的王.jpg");
//	    System.out.println(getClass().getClassLoader().getResource(""));
//			Image image = ImageIO.read(getClass().getResourceAsStream(".././image/他的王.jpg"));
//			upPanel.getGraphics().drawImage(image, 1, 1, 2, 2, 1, 1, 2, 2,null);
//			System.out.println(upPanel.getName());
//			upPanel.getGraphics().fillOval(160, 80, 80, 80);
        upPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
        JButton jbtClose = new JButton("X");
        Font font = new Font("宋体",Font.BOLD,20);
//        jbtClose.setContentAreaFilled(false); 设置透明
        jbtClose.setBorderPainted(false);
//        jbtClose.setOpaque(false);
        jbtClose.setFont(font);
        jbtClose.setForeground(Color.black);
//        ImageIcon imageClose = new ImageIcon("image/关闭.jpg");
//        jbtClose.setIcon(imageClose);
//        jbtClose.setBorderPainted(false);
        JButton jbtMin = new JButton("-");
        jbtMin.setBorderPainted(false);
        jbtMin.setFont(font);
        upPanel.add(jbtMin);
        upPanel.add(jbtClose);
	    Container container = getContentPane();
        container.setLayout(new GridLayout(2, 0));
	    container.add(upPanel);
        container.add(mainPanel);
//	    centerPanel.setForeground(Color.BLUE);
//	    centerPanel.setBackground(Color.BLUE);
//	    downPanel.setForeground(Color.BLUE);
//	    downPanel.setBackground(Color.BLUE);
        
        jbtClose.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
	    
    }
    public static void main(String[] args) {
		JFrame frame = new LoginView();
		frame.setSize(350, 250);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		frame.setTitle("qq注册");
		frame.setResizable(false);
		frame.setUndecorated(true);
		frame.setVisible(true);
	}
}
    不知道整了一些什么玩意,总之,今天没有弄什么东西,主要是想要把java看完的原因吧,这样也好,虽然最后看的很匆忙,但是也还好了,忘了再去看就好了,行,就这样吧,结束。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值