这是一个管理员个人中心页面效果图:
代码如下:
package _课程设计;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class _个人中心 {
public static void main(String[] args) {
// TODO Auto-generated method stub
mycenter m=new mycenter();
m.start();
}
}
class mycenter extends JFrame{
JLabel jl1,jl2,jl3,jl4,jl5,jl6,jlt;
ImageIcon image;
void start() {
inti();
setVisible(true);
setTitle(“个人中心”);
setSize(1000,800);
setLocation(380, 200);
setResizable(false);//锁定窗口大小
setLocationRelativeTo(null);//设置窗口相对于主键的位置
setDefaultCloseOperation(EXIT_ON_CLOSE);//关闭窗口可结束程序运行
}
void inti() {
image =new ImageIcon(“src/li/123.jpg”);
JLabel jlabel=new JLabel(image);
getLayeredPane().add(jlabel,new Integer(Integer.MIN_VALUE));
jlabel.setBounds(0, 0, image.getIconWidth(), image.getIconHeight());
Container contain = this.getContentPane();
((JPanel) contain).setOpaque(false);
jl2=new JLabel("性 别:");
jl3=new JLabel("年 龄:");
jl5=new JLabel("证件号码:");
jl4=new JLabel("电话号码:");
jlt=new JLabel("欢迎管理员");
setLayout(null);
jl1=new JLabel("用户名:");
jl1.setFont(new Font("微软雅黑",Font.PLAIN,20));
jl2.setFont(new Font("微软雅黑",Font.PLAIN,20));
jl3.setFont(new Font("微软雅黑",Font.PLAIN,20));
jl4.setFont(new Font("微软雅黑",Font.PLAIN,20));
jl5.setFont(new Font("微软雅黑",Font.PLAIN,20));
jlt.setFont(new Font("微软雅黑",Font.PLAIN,25));
jl1.setBounds(650, 30, 150, 100);
jl2.setBounds(650, 80, 150, 100);
jl3.setBounds(650, 130, 150, 100);
jl4.setBounds(650, 180, 150, 100);
jl5.setBounds(650,230,150,100);
jlt.setBounds(30, 30, 150, 100);
jl1.setForeground(Color.white);
jl2.setForeground(Color.white);
jl3.setForeground(Color.white);
jl4.setForeground(Color.white);
jl5.setForeground(Color.white);
jlt.setForeground(Color.white);
add(jl1);
add(jl2);
add(jl3);
add(jl4);
add(jl5);
add(jlt);
}
}