首页窗口类packagecom.beyole.util;importjava.awt.BorderLayout;importjava.awt.GridLayout;importjavax.swing.JFrame;importjavax.swing.JPanel;importjava.awt.event.ActionEvent;...
首页窗口类
package com.beyole.util;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
@SuppressWarnings("serial")
class win3 extends JFrame implements ActionListener {
@SuppressWarnings("unused")
private JButton btBlue, btDialog;
public win3(){
this.setTitle("同学录管理系统");//设置标题
JPanel south = new JPanel(new GridLayout(1,10,9,10));
south.add(new JButton ("登录"));//点击事件
this.setResizable(false);//关闭当前界面
south.add(new JButton ("开发团队"));//点击事件
this.setResizable(false);//关闭当前界面
this.add(south, BorderLayout.SOUTH);
this.setResizable(false);//不可改变大小
this.setLocationRelativeTo(null);//居中显示
this.setSize(400, 400);//窗体大小
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//默认关闭操作
}
private static void win2(boolean b) {
// TODO Auto-generated method stub
}
public static void main(String[] args) {
new win3().setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO 自动生成的方法存根
}
public JButton getBtBlue() {
return btBlue;
}
public void setBtBlue(JButton btBlue) {
this.btBlue = btBlue;
}
}
第B类按钮部分
public win2()
{
super("同学录管理系统菜单");
//框架中加载面板
pan p =new pan();
this.add(p);
Font d=new Font("宋体",Font.BOLD,100);
JPanel south = new JPanel(new GridLayout(2,2,2,2));
south.add(new JButton ("浏览"));
south.add(new JButton ("查找"));
south.add(new JButton ("增加"));
south.add(new JButton ("删除"));
south.add(new JButton ("退出"));
south.add(new JButton ("返回上一级"));
this.add(south, BorderLayout.SOUTH);
}如何A跳转到第B类窗口呢?
展开