Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize a simple Student status Management system by java

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces java how to achieve a simple student status management system, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The details are as follows

Code import java.awt.*;import java.awt.event.*;import java.io.*;import javax.swing.*; public class TestStudentManager {private int rows = 0; private String [] [] unit = new String [rows] [5]; private String [] name = {"name", "language", "Mathematics", "Foreign language", "Total score"}; public JTable table Public static void main (String [] args) {new TestStudentManager ();} TestStudentManager () {JFrame frame = new JFrame ("simulated student management system"); table = new JTable (unit, name); JPanel southPanel = new JPanel (); southPanel.add (new JLabel ("add students"); JButton calc = new JButton ("calculate grades") JButton save = new JButton ("Save student information"); JTextField input = new JTextField (5); southPanel.add (input); southPanel.add (calc); southPanel.add (save); frame.add (new JLabel ("Welcome to the Student Management system", BorderLayout.NORTH); frame.add (southPanel, BorderLayout.SOUTH); frame.add (new JScrollPane (table), BorderLayout.CENTER) Frame.setSize (400,400); frame.setVisible (true); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); input.addActionListener (new ActionListener () {public void actionPerformed (ActionEvent e) {rows = Integer.valueOf (input.getText ()); unit = new String [rows] [5]; table = new JTable (unit, name) System.out.println ("xx"); frame.getContentPane (). RemoveAll (); frame.add (new JScrollPane (table), BorderLayout.CENTER); frame.add (southPanel, BorderLayout.SOUTH); frame.add (new JLabel ("Welcome to the Student Management system", BorderLayout.NORTH); frame.validate () Table.setRowHeight (25);}}); calc.addActionListener (new ActionListener () {public void actionPerformed (ActionEvent e) {for (int I = 0; I < rows; iTunes +) {double sum = 0; boolean flag = true; for (int j = 1; j)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report