补上一条博客
CreatePanel.java
发完了才发现有一部分代码不全
可能因为网不好 编辑老出问题
import java.awt.*;
import javax.swing.*;
public class CreatePanel {
private static LoginListener ll=null;
//顶部面板区域
public static JPanel CreateNorthPanel (JFrame jf) {
//创建一个JPanel顶部面板
JPanel panel=new JPanel();
//取消面板内默认布局
panel.setLayout(null);
//设置顶部面板尺寸
panel.setPreferredSize(new Dimension(0,140));
//1.1向顶部面板添加背景照片
ImageIcon image=new ImageIcon("back.jpg");
JLabel background=new JLabel(image);
//设置背景照片的位置及尺寸
background.setBounds(0,0,426,image.getIconHeight());
panel.add(background);
//1.2在顶部JPanel面板右上角添加一个退出按钮
JButton out=new JButton(new ImageIcon("java.jpg"));
out.setBounds(403,0,26,26);
//设置鼠标移动到退出按钮时更改图片
out.setRolloverIcon(new ImageIcon("close.jpg"));
//取消按钮边框效果
out.setBorderPainted(false);
out.addActionListener(event->jf.dispose());
panel.add(out);
return panel;
}
//左侧面板区域
public static JPanel CreateWestPanel() {
//2.创建一个JPanel左侧面板
JPanel panel=new JPanel();
panel.setLayout(null);
panel.setPreferredSize(new