📄 navigatorpanel.java
字号:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import edu.njust.cs.*;
public class NavigatorPanel extends JPanel{
JButton btnCZ=new TextAndPicButton("image/chuzhang20.gif"," 出 帐 ");
JButton btnCharge=new TextAndPicButton("image/charge20.gif"," 缴 费 ");
JButton btnConfig=new TextAndPicButton("image/config20.gif"," 配 置 ");
JButton btnExit=new TextAndPicButton("image/exit20.gif"," 退 出 ");
MainApp father=null;
public NavigatorPanel(MainApp f){
father=f;
f.labStatusContent.setText(" 您目前的位置是导航面板,"+
"点击工具条上的按钮,可以快速进入相应功能");
this.setLayout(new BorderLayout());
JLabel labPic=new JLabel();
labPic.setIcon(new ImageIcon("image/splash.jpg"));
labPic.setBorder(BorderFactory.createLoweredBevelBorder());
labPic.setHorizontalAlignment(SwingConstants.CENTER);
add(labPic,BorderLayout.CENTER);
constructToolbar();
}
public void constructToolbar(){
JToolBar toolbar=new JToolBar();
this.add(toolbar,BorderLayout.NORTH);
toolbar.setFloatable(false);
//按照用户权限构建工具条
toolbar.add(btnCZ);
btnCZ.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
father.setSelectedPanel(new DBCZPanel(father,father.con));
}
});
toolbar.add(this.btnCharge);
btnCharge.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
father.setSelectedPanel(new DBSFPanel(father,father.con));
}
});
toolbar.add(this.btnConfig);
this.btnConfig.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
new ConfigDialog(father,"系统设置",true).show();
}
});
toolbar.add(this.btnExit);
this.btnExit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Object[] options = {"确定","取消"};
int n = JOptionPane.showOptionDialog(father,
"确实退出本程序吗?",
"确认",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, options, options[1]);
if(n==JOptionPane.YES_OPTION) System.exit(0);
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -