📄 interframe.java~105~
字号:
package bank;
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
//用户界面类
public class InterFrame extends JFrame implements ActionListener
{
public InterFrame()
{
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
);
}
private void jbInit() throws Exception {
this.setForeground(Color.white);
this.setJMenuBar(jMenuBar1);
this.setSize(new Dimension(400, 300));
this.getContentPane().setLayout(xYLayout1);
this.getContentPane().setBackground(new Color(230, 217, 0));
jMenu2.setText("登陆");
jMenu4.setText("作者");
jMenuItem2.setText("存钱");
jMenuItem1.setText("取钱");
jMenu1.setText("退出");
jMenuItem3.addActionListener(new InterFrame_jMenuItem3_actionAdapter(this));
jMenuItem3.setText("登陆");
jMenuItem5.setText("资料");
jMenuItem5.addActionListener(new InterFrame_jMenuItem5_actionAdapter(this));
jMenuItem6.setText("结束");
jMenuItem6.addActionListener(new InterFrame_jMenuItem6_actionAdapter(this));
xYLayout1.setWidth(400);
xYLayout1.setHeight(300);
jMenuBar1.add(jMenu2);
jMenuBar1.add(jMenu4);
jMenuBar1.add(jMenu1);
jMenu2.add(jMenuItem2);
jMenu2.add(jMenuItem1);
jMenu2.add(jMenuItem3);
jMenu4.add(jMenuItem5);
jMenu1.add(jMenuItem6);
jMenuItem2.setVisible(false);
jMenuItem1.setVisible(false);
}
JMenuBar jMenuBar1 = new JMenuBar();
void login_true(){
login = true;
}
void login_false(){
login = false;
}
void SetCardID(int ID){
customer_id = ID;
}
private int customer_id;
private boolean login = false;
JMenu jMenu2 = new JMenu();
JMenu jMenu4 = new JMenu();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem2 = new JMenuItem();
JMenu jMenu1 = new JMenu();
JMenuItem jMenuItem3 = new JMenuItem();
JMenuItem jMenuItem5 = new JMenuItem();
JMenuItem jMenuItem6 = new JMenuItem();
XYLayout xYLayout1 = new XYLayout();
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==jMenuItem3)
{
loginDialog da=new loginDialog(this,"数据查询",true);
da.show();
if(login){
welpanel c11 = new welpanel(this, customer_id);
this.remove(this.getContentPane());
this.setContentPane(c11);
jMenuItem1.setVisible(true);//连接成功,让存款,取钱可以用
jMenuItem2.setVisible(true);
this.show();
}
}
}
public void jMenuItem3_actionPerformed(ActionEvent e) {
if(e.getSource()==jMenuItem3)
{
loginDialog da=new loginDialog(this,"数据查询",true);
da.show();
if(login){
welpanel c11 = new welpanel(this, customer_id);
this.remove(this.getContentPane());
this.setContentPane(c11);
jMenuItem1.setVisible(true);//连接成功,让存款,取钱可以用
jMenuItem2.setVisible(true);
this.show();
}
}
}
public void jMenuItem4_actionPerformed(ActionEvent e) {
}
public void jMenuItem5_actionPerformed(ActionEvent e) {
if(e.getSource()==jMenuItem5)
{
AuthorDialog author=new AuthorDialog();
author.setSize(300,300);
author.show();
}
}
public void jMenuItem6_actionPerformed(ActionEvent e) {
if(e.getSource()==jMenuItem6)//捕捉鼠标点击
System.exit(0);//主窗口正常退出,如果是1就是异常退出,子窗口退出是用dipose()函数
}
}
class InterFrame_jMenuItem6_actionAdapter
implements ActionListener {
private InterFrame adaptee;
InterFrame_jMenuItem6_actionAdapter(InterFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem6_actionPerformed(e);
}
}
class InterFrame_jMenuItem5_actionAdapter
implements ActionListener {
private InterFrame adaptee;
InterFrame_jMenuItem5_actionAdapter(InterFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem5_actionPerformed(e);
}
}
class InterFrame_jMenuItem3_actionAdapter
implements ActionListener {
private InterFrame adaptee;
InterFrame_jMenuItem3_actionAdapter(InterFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem3_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -