⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 homepage.java

📁 学生成绩管理系统:能输入学科
💻 JAVA
字号:
import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author HSM */public class Homepage{    public static void main(String[] args){        WelcomeFrame();            }    protected static void WelcomeFrame(){        final JFrame frame = new JFrame("综合性实验");        final Container container = frame.getContentPane();        final Font font1 = new Font("SansSerif",Font.BOLD,40);        JMenuBar menuBar = new JMenuBar();        frame.setJMenuBar(menuBar);        JMenu Menu1 = new JMenu("工具");        JMenu Menu2 = new JMenu("帮助");        JMenu Menu3 = new JMenu("退出");        menuBar.add(Menu1);        menuBar.add(Menu2);        menuBar.add(Menu3);                JMenuItem Mu1Item1 = Menu1.add(new TestAction("基本数据输入"));        JMenuItem Mu1Item2 = Menu1.add(new TestAction("考试成绩输入"));        JMenuItem Mu1Item3 = Menu1.add(new TestAction("成绩查询"));        JMenuItem Mu1Item4 = Menu1.add(new TestAction("成绩分析"));         JMenuItem Mu2Item1 = Menu2.add(new TestAction("首页"));        JMenuItem Mu2Item = Menu2.add(new TestAction("关于"));        JMenuItem Mu3Item = Menu3.add(new TestAction("退出"));                JPanel p1 = new JPanel(new BorderLayout());        final JLabel jLabel1 = new JLabel("学生考试成绩分析系统",SwingConstants.CENTER);        jLabel1.setFont(font1);        p1.add(jLabel1,BorderLayout.NORTH);//        JPanel p3 = new JPanel(new FlowLayout());        JPanel p2 = new JPanel(new FlowLayout());        JButton jbt1 = new JButton("基本数据输入");        p2.add(jbt1);        JButton jbt2 = new JButton("考试成绩输入");        p2.add(jbt2);        JButton jbt3 = new JButton("    成绩查询    ");        p2.add(jbt3);        JButton jbt4 = new JButton("    成绩分析    ");        p2.add(jbt4);        p1.add(p2,BorderLayout.CENTER);        container.add(p1,SwingConstants.CENTER);        frame.setSize(600,400);        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();        int screenHeight = screenSize.height;        int screenWidth = screenSize.width;        int x = (screenWidth -frame.getWidth()) / 2;        int y = (screenHeight - frame.getHeight()) / 2;        frame.setLocation(x,y);        frame.setVisible(true);        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        ButtonListener1 btListener1 = new ButtonListener1();        jbt1.addActionListener(btListener1);            ButtonListener2 btListener2 = new ButtonListener2();        jbt2.addActionListener(btListener2);        ButtonListener3 btListener3 = new ButtonListener3();        jbt3.addActionListener(btListener3);        ButtonListener4 btListener4 = new ButtonListener4();        jbt4.addActionListener(btListener4);        Mu1Item1.addActionListener(new ButtonListener1());        Mu1Item2.addActionListener(new ButtonListener2());        Mu1Item3.addActionListener(new ButtonListener3());        Mu1Item4.addActionListener(new ButtonListener4());                Mu3Item.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                System.exit(0);            }        });        Mu2Item.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                JPanel p1 = new JPanel(new GridLayout(5,0));                JLabel jLabel2 = new JLabel("华南农业大学 07软件工程8班",SwingConstants.CENTER);                JLabel jLabel3 = new JLabel("200731000808 黄宋明 制作\n",SwingConstants.CENTER);                JLabel jLabel6 = new JLabel("",SwingConstants.CENTER);                JLabel jLabel7 = new JLabel("",SwingConstants.CENTER);                jLabel6.setFont(font1);                jLabel7.setFont(font1);                p1.add(jLabel1);                p1.add(jLabel6);                p1.add(jLabel2);                p1.add(jLabel3);                p1.add(jLabel7);             //   frame.setVisible(false);                frame.getContentPane().removeAll();                container.add(p1,SwingConstants.CENTER);                frame.setVisible(true);            }        });          Mu2Item1.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                frame.dispose();                WelcomeFrame();            }        });        }}class TestAction extends AbstractAction{   public TestAction(String name) { super(name); }   public void actionPerformed(ActionEvent event){    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -