?? 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 + -