📄 firstframe.java
字号:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Container;
class FirstFrame extends JFrame implements ActionListener
{
//private JPanel aPanel = new JPanel();
private JButton button1;
private JButton button2;
private JButton button3;
private JButton button4;
private JButton button5;
private JLabel aLabel;
private JLabel bLabel;
private JLabel cLabel;
ImageIcon ico = new ImageIcon("/iclon/1.jpg");
private ImagePanel aPanel = new ImagePanel(ico);
private String id;
public FirstFrame(String id)
{
this.id = id;
setTitle("欢迎进入选课系统");
setupGUI();
}
private void setupGUI()
{
setSize(800,500);
setLocation(100,50);
Container ConTen = getContentPane();
ConTen.add(aPanel);
setupPanel();
}
private void setupPanel()
{
aPanel.setLayout(null);
aLabel = new JLabel(id.toString()+", 欢迎你!");
aLabel.setSize(200,30);
aLabel.setLocation(200,60);
aLabel.setBackground(Color.pink);
aPanel.add(aLabel);
Icon rollover=new ImageIcon(".\\icon\\base.jpg");
button1 = new JButton("基本信息");
button1.setRolloverEnabled(true);
button1.setIcon(rollover);
//button1.setIcon();
button1.setSize(100,80);
button1.setLocation(100,100);
aPanel.add(button1);
button1.addActionListener(this);
button2 = new JButton("选课系统");
//button2.setIcon(ico2);
button2.setSize(100,80);
button2.setLocation(220,100);
aPanel.add(button2);
button2.addActionListener(this);
button3 = new JButton("查询成绩");
//button3.setIcon(ico3);
button3.setBackground(Color.red);
button3.setSize(100,80);
button3.setLocation(340,100);
aPanel.add(button3);
button3.addActionListener(this);
button4 = new JButton("课程表");
//button3.setIcon(ico3);
button4.setSize(100,80);
button4.setLocation(460,100);
aPanel.add(button4);
button4.addActionListener(this);
button5 = new JButton("修改密码");
//button3.setIcon(ico3);
button5.setSize(100,80);
button5.setLocation(580,100);
aPanel.add(button5);
button5.addActionListener(this);
bLabel = new JLabel("会泽百家 至公天下");
bLabel.setFont(new Font("Default",12,32));
bLabel.setSize(500,50);
bLabel.setLocation(230,320);
aPanel.add(bLabel);
cLabel = new JLabel("版权所有---郑阶财.请勿侵权,违者必究!");
cLabel.setSize(500,40);
cLabel.setLocation(250,420);
aPanel.add(cLabel);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button1)
{
BaseInfFrame aFrame = new BaseInfFrame(this.id);
aFrame.show();
}
else if(e.getSource()==button2)
{
ChooseFrame aFrame = new ChooseFrame(this.id);
aFrame.show();
}
else if(e.getSource()==button3)
{
ScoreSearch aFrame = new ScoreSearch(this.id);
aFrame.show();
}
else if(e.getSource()==button4)
{//课程表
CourseSearch aFrame = new CourseSearch(this.id);
aFrame.show();
}
else if(e.getSource()==button5)
{
Password aFrame = new Password(this.id);
aFrame.show();
}
}
/*public void paintComponent(Graphics g)
{
int x=0,y=0;
ImageIcon icon = new ImageIcon("base.gif");
g.drawImage(icon.getImage(),x,y,this);
} */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -