GIỚI THIỆU
Java là một nền tảng phát triển ứng dụng phần mềm quan trọng, đặc biệt trong những năm cuối thế kỷ 20 và đầu thế kỷ 21 Nó đánh dấu sự phát triển của lập trình hướng đối tượng và được xem là một cuộc cách mạng trong ngành phần mềm Với mô hình máy ảo, Java cho phép các ứng dụng chạy trên nhiều hệ điều hành khác nhau.
Java là ngôn ngữ lập trình quan trọng được sử dụng để phát triển ứng dụng máy tính hàng ngày Khi tải ứng dụng yêu cầu Java, người dùng cần cài đặt nó trên máy tính Bên cạnh đó, Java còn cung cấp plug-in cho trình duyệt web, giúp một số ứng dụng hiển thị trực tiếp trong trình duyệt.
Hiện nay, sự phát triển của công nghệ thông tin đã dẫn đến việc áp dụng rộng rãi và đa dạng trong công việc và học tập Giáo dục đang tăng cường mở rộng các ngành công nghệ thông tin, giúp quản lý thông tin một cách bảo mật, đồng bộ, hiệu quả và an toàn hơn Ngoài ra, công nghệ thông tin cũng đã được áp dụng triệt để trong tuyển sinh, mang lại hiệu quả lớn cho quá trình này.
Nhập thông tin thí sinh.
Nhập điểm của thí sinh.
Xem thông tin hoặc điểm của thí sinh.
Sửa thông tin hoặc điểm của thí sinh.
Xóa thông tin hoặc điểm của thí sinh.
Chương trình có giao diện.
Giao diệm đơn giản và dể sử dụng.
Chương trình có khả năng nâng cấp.
CÔNG NGHỆ SỬ DỤNG
Java
Ngôn ngữ Java được tạo ra bởi James Gosling trong dự án Green của Sun
MicroSystems chuyên phát triển phần mềm cho các thiết bị dân dụng, sử dụng ngôn ngữ lập trình hoàn toàn hướng đối tượng Ngôn ngữ này được thiết kế an toàn, giúp hạn chế các thao tác có thể gây nguy hiểm cho máy tính thực.
Ngôn ngữ lập trình như C, C++, Perl và SmallTalk có khả năng cao trong việc phát triển ứng dụng để giải quyết các vấn đề về số, xử lý văn bản, và tạo trò chơi Các môi trường lập trình đồ họa như Visual Java, Symantec Cafe, Jbuilder và Jcreator hỗ trợ lập trình viên trong quá trình phát triển Ngoài ra, ngôn ngữ này còn cho phép truy cập dữ liệu từ xa thông qua JDBC (Java DataBase Connectivity) và hỗ trợ các lớp tiện ích cho lập trình ứng dụng mạng (Socket) cũng như truy xuất web, đồng thời hỗ trợ lập trình phân tán.
Remote Method Invocation (RMI) cho phép ứng dụng xử lý phân tán trên nhiều máy tính khác nhau Java là một ngôn ngữ hoàn toàn hướng đối tượng, đa nền, cho phép chương trình thực thi trên các hệ điều hành như MS Windows, UNIX, và Linux mà không cần biên dịch lại Phương châm "Viết một lần, Chạy trên nhiều nền" (Write Once, Run Anywhere) thể hiện tính linh hoạt của Java Ngoài ra, Java hỗ trợ đa luồng, cho phép thực thi nhiều luồng điều khiển song song, rất hữu ích cho xử lý song song Ngôn ngữ này cũng hỗ trợ tính năng phân tán, cho phép các đối tượng của ứng dụng được phân bố và thực thi trên các máy tính khác nhau Java còn cho phép tải mã lệnh từ xa, đảm bảo tính động cho ứng dụng Đặc biệt, Java an toàn khi tất cả các thao tác truy xuất vào thiết bị vào ra đều thực hiện trên máy ảo, giảm thiểu rủi ro cho máy tính thực Cuối cùng, Java được thiết kế đơn giản, dễ học với kiến trúc chương trình rõ ràng.
Để xem phim, bạn chỉ cần sử dụng Java, vì mọi thứ khác sẽ tự động được xử lý Điều này có nghĩa là bạn chỉ cần thực hiện như bình thường, miễn là máy tính của bạn đã cài đặt Java.
MySQL là hệ quản trị cơ sở dữ liệu nguồn mở phổ biến nhất thế giới, được các nhà phát triển ưa chuộng nhờ vào tốc độ cao, tính ổn định và dễ sử dụng Hệ thống này hoạt động trên nhiều hệ điều hành và cung cấp nhiều hàm tiện ích mạnh mẽ Với tính bảo mật cao, MySQL rất phù hợp cho các ứng dụng truy cập cơ sở dữ liệu trên internet Người dùng có thể tải MySQL miễn phí từ trang chủ, với nhiều phiên bản tương thích cho các hệ điều hành như Windows, Linux và Mac OS X.
MySQL là một hệ quản trị cơ sở dữ liệu quan hệ nổi bật, sử dụng ngôn ngữ truy vấn có cấu trúc (SQL) để quản lý và truy xuất dữ liệu hiệu quả.
MySQL là hệ quản trị cơ sở dữ liệu phổ biến, hỗ trợ cho các ngôn ngữ lập trình như PHP và Perl, giúp lưu trữ thông tin cho các trang web được phát triển bằng những ngôn ngữ này.
MySQL là phần mềm quản trị cơ sở dữ liệu server-based tương tự như SQL Server của Microsoft, cho phép quản lý dữ liệu qua các cơ sở dữ liệu (CSDL) với nhiều bảng quan hệ Phần mềm này có cơ chế phân quyền người sử dụng, trong đó mỗi người dùng được cấp một tên truy cập và mật khẩu để truy xuất CSDL Để thực hiện truy vấn, người dùng cần cung cấp thông tin xác thực; nếu không, họ sẽ không thể thao tác với CSDL, tương tự như cơ chế xác thực trong SQL Server.
PHÂN TÍCH BÀI TOÁN
Nội dung: Thông tin về chương trình.
Các thư viện: Java.Swing.*, Javax.awt.*
Nội dung: Tạo một kết nối với cơ sở dữ liệu.
Các thư viện: Java.sql.*
Thể hiện: Kết nối với CSDL, trả về kết quả kết nối: thành công/không thành công, ngắt kết nối với CSDL.
Nội dung: Giao diện chính của chương trình.
Thư viện: Java.Swing.*, Javax.awt.*, : Java.sql.*
Thể hiện: Cửa sổ Jframe, thao tác với người dùng qua nhấp chuột, nhập text,…
Nội dung: Giao diện chính của chương trình.
Thể hiện: Thao tác đưa dữ liệu vao cơ sở dữu liệu,
Thực hiện các nhiệm vụ xóa, thêm, sửa dữ liệu.
Nội dung: lớp thí sinh chứa các thuộc tính của thí sinh.
Mathisinh int Tenthisinh String Ngaysinh Date Gioitinh boolean
Diemtoan double Diemly double Diemhoa double
Thể hiện: Các hàm khởi tạo, get, set.
Nội dung: lớp tỉnh thành, chứ thông tin mã tỉnh và tên tỉnh.
Các thuộc tính: matinh (int), tentinh (String)
Thể hiện: Các hàm khởi tạo, get, set.
2Sơ đồ cơ sở dữ liệu:
ThiSinh (maThiSinh, tenThiSinh, maQueQuan, ngaysinh, gioitinh, diemToan, diemLy, diemHoa)
Mô tả KDL Ràng buộc
1 matinh Mã tỉnh int PK
STT Thuộc tính Mô tả KDL Ràng buộc
1 maThiSinh Mã thí sinh int PK
3 maQueQua n Mã quê quán int
HIỆN THỰC BÀI TOÁN
Sử dụng
Giao diện chính của chương trình
-Danh sách các thí sinh ban đầu là các thí sinh đã có sẵn trong CSDL
-Tìm kiếm: nhập tên tỉnh thành/ mã sinh viên vào BirthPlace/StudentID và ấn nút FITLER
-Thêm thí sinh: ấn nút INSERT điền vào các trường
ID,NAME,BIRTHPLACE,DATE,SEX ,MATH,….và nhấn OK
Xóa thí sinh: Chọn thí sinh cần xóa, ấn nút DELETE
- Sửa thí sinh: Chọn thí sinh, ấn vào EDIT, điền các thông tin mới và ấn OK
2.1 AboutMe: import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import java.awt.Color; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class aboutme extends JDialog { private final JPanel contentPanel = new JPanel(); public static void main(String[] args) { try { aboutme dialog = new aboutme(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setLocationRelativeTo(null); dialog.setVisible(true);
The "About Me" dialog is designed with a default close operation set to dispose, ensuring it closes properly when finished It features a title and is sized appropriately for display The content panel, set against a soft background color, has no border and utilizes a null layout for custom placement of elements within the dialog.
JLabel lblGingVinHng = new JLabel("Chuong Trinh Quan Li Thi Sinh"); lblGingVinHng.setBounds(10, 45, 227, 34); contentPanel.add(lblGingVinHng);
JLabel lblNgiThcHin = new JLabel("Nguyen Ngoc Tri"); lblNgiThcHin.setBounds(10, -4, 247, 49); contentPanel.add(lblNgiThcHin);
JLabel lblLpCngNgh = new JLabel("CNTT55"); lblLpCngNgh.setBounds(10, 24, 170, 34); contentPanel.add(lblLpCngNgh);
2.2 ConnectDatabase: import java.sql.Connection; import java.sql.DriverManager; public class ConnectDatabase { public static Connection getConnection() {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://" + host + ":" + port + "/" + dbName; String user = "root";
String pass = ""; c = DriverManager.getConnection(url, user, pass);
} public static void closeConnection(Connection c) { try { if (c != null) c.close();
} public static void main(String[] args) {
2.3 student: import java.awt.Color; import java.awt.Component; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.sql.Date; import java.util.ArrayList; import javax.swing.UIManager; import javax.swing.UIManager.*; import javax.swing.ButtonGroup; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import org.eclipse.wb.swing.FocusTraversalOnArray; import java.awt.SystemColor; public class student extends JFrame{ private JPanel contentPane; private JTextField textField_BirthPlace; private JTextField textField_StudentID; private JTextField textField_ID; private JTextField textField_Name; private JTextField textField_Place; private final ButtonGroup buttonGroup = new ButtonGroup(); private JTextField textField_Math; private JTextField textField_Physical; private JTextField textField_Chemistry; private JTextField textField_Total; double tongDiem; private JRadioButton rdbtnMale; private JRadioButton rdbtnFemale; private JComboBox comboBox_ngay; private JComboBox comboBox_thang; private JComboBox comboBox_nam; private JPanel panel; private JPanel panel_1; private JPanel panel_2; private JPanel panel_3; private JComboBox comboBox_BirthPlace; int kt = 0; private static JTable table;
*/ public static void main(String[] args) {
// Look And Feel try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName()); break;
// If Nimbus is not available, you can set the GUI to another look
@Override public void run() { try { student frame = new student(); loadThiSinh(); frame.setLocationRelativeTo(null); frame.setVisible(true);
*/ public student() { setResizable(false); setForeground(Color.BLACK); setBackground(Color.BLACK); setTitle("Quản lý thí sinh"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 683, 696);
JMenuBar menuBar = new JMenuBar(); menuBar.setBackground(SystemColor.desktop); setJMenuBar(menuBar);
JMenu mnNewMenu = new JMenu("File"); menuBar.add(mnNewMenu);
The JMenuItem "Open" is created and assigned a keyboard shortcut using CTRL + O An ActionListener is added to the menu item, which makes multiple panels visible when the item is activated.
To implement a "Close" menu item in a Java Swing application, create a JMenuItem named mnClose and set its accelerator to Ctrl + W using KeyStroke Add an ActionListener to mnClose that hides multiple panels (panel, panel_1, panel_2, and panel_3) when triggered.
JSeparator separator = new JSeparator(); mnNewMenu.add(separator);
JMenuItem mnExit = new JMenuItem("Exit"); mnExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4,
InputEvent.ALT_MASK)); mnExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {
JMenu mnNewMenu_1 = new JMenu("About"); menuBar.add(mnNewMenu_1);
JMenuItem mnAboutme = new JMenuItem("About me "); mnAboutme.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12,
InputEvent.CTRL_MASK)); mnAboutme.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aboutme.main(null);
The content pane is designed with a background of inactive caption text and features a desktop foreground, creating a visually appealing interface It is bordered with no additional framing and utilizes a null layout for flexibility Additionally, a panel with a control shadow background is included, framed by a titled border to enhance its aesthetic appeal.
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 255))); panel.setBounds(10, 11, 654, 60);
//panel.setVisible(false); contentPane.add(panel); panel.setLayout(null);
JLabel lblBirthplace = new JLabel("BirthPlace"); lblBirthplace.setBounds(10, 24, 63, 25); panel.add(lblBirthplace); textField_BirthPlace = new JTextField(); textField_BirthPlace.setBounds(83, 26, 170, 20); panel.add(textField_BirthPlace); textField_BirthPlace.setColumns(10);
JLabel lblStudentid = new JLabel("StudentID"); lblStudentid.setBounds(298, 29, 61, 20); panel.add(lblStudentid); textField_StudentID = new JTextField(); textField_StudentID.setBounds(369, 26, 147, 20); panel.add(textField_StudentID); textField_StudentID.setColumns(10);
JButton btnFiltre = new JButton("Filter"); btnFiltre.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (textField_BirthPlace.getText().trim().equals("")
&& textField_StudentID.getText().trim().equals("")) {
JOptionPane.showMessageDialog(null, "Vui long nhap thong tin can tim kiem"); return;
} if (textField_BirthPlace.getText().trim().equals("")
&& !textField_StudentID.getText().trim().equals("")) loadThiSinhTheoID(textField_StudentID.getText()); if (textField_StudentID.getText().trim().equals("")
&& !textField_BirthPlace.getText().trim().equals("")) loadThiSinhTheoNoiSinh(textField_BirthPlace.getText()); if (!textField_StudentID.getText().trim().equals("")
&& !textField_BirthPlace.getText().trim().equals("")) loadThiSinhTheoNoiSinhVaID(textField_BirthPlace.getText(),
Integer.parseInt(textField_StudentID.getText()));
The button 'btnFiltre' is customized with a background color of light beige (RGB: 255, 248, 220) and blue text (RGB: 0, 0, 255), featuring a bold 18-point Times New Roman font It is positioned at coordinates (536, 25) with a size of 89x23 pixels on the panel Additionally, a new panel, 'panel_1', is created with a shadow background and a titled border, enhancing the visual appeal of the user interface.
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 255))); panel_1.setBounds(10, 82, 654, 313);
//panel_1.setVisible(false); contentPane.add(panel_1); panel_1.setLayout(null);
JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 22, 634, 280); panel_1.add(scrollPane); table = new JTable(); table.addMouseListener(new MouseAdapter() {
When the mouse is clicked, the application retrieves and displays the selected row's data from the table Specifically, it sets the text fields for ID, Name, and Place with values from the corresponding columns of the selected row Additionally, it updates the combo box selection based on the selected index.
Integer.parseInt(table.getValueAt(table.getSelectedRow(), 4).toString().substring(8, 10)) - 1); comboBox_thang.setSelectedIndex(
Integer.parseInt(table.getValueAt(table.getSelectedRow(), 4).toString().substring(5, 7))
- Integer.parseInt(table.getValueAt(table.getSelectedRow(), 4).toString().substring(0, 4))); if ((table.getValueAt(table.getSelectedRow(), 5) + "").compareToIgnoreCase("Nam")
== 0) rdbtnMale.setSelected(true); else rdbtnFemale.setSelected(true);
The code retrieves and displays values from a selected row in a table It prints the value from the fifth column of the selected row, then sets the text fields for Math, Physical, and Chemistry with values from the sixth, seventh, and eighth columns, respectively Finally, it calculates the total by parsing the Math value from the selected row and setting it in the Total text field.
+ Double.parseDouble(table.getValueAt(table.getSelectedRow(), 7).toString())
The selected row's value in the table is parsed as a double and assigned accordingly All relevant text fields, including ID, Name, Place, Math, Physical, and Chemistry, are set to non-editable to prevent user modifications Additionally, the radio buttons for gender selection (Female and Male) are disabled, and the date selection combo boxes for day, month, and year are also set to a non-editable state Finally, the Total text field is likewise made non-editable, ensuring that all critical information remains unchanged.
}); scrollPane.setViewportView(table); panel_2 = new JPanel(); panel_2.setBackground(SystemColor.textInactiveText); panel_2.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 255))); panel_2.setBounds(10, 406, 654, 165);
//panel_2.setVisible(false); panel_2.setEnabled(false); contentPane.add(panel_2); panel_2.setLayout(null);
JLabel lblId = new JLabel("ID"); lblId.setBounds(10, 30, 11, 14); panel_2.add(lblId);
JLabel lblName = new JLabel("Name"); lblName.setBounds(10, 55, 58, 14); panel_2.add(lblName);
JLabel lblBirthplace_1 = new JLabel("BirthPlace"); lblBirthplace_1.setBounds(10, 82, 65, 14); panel_2.add(lblBirthplace_1);
JLabel lblDate = new JLabel("Date"); lblDate.setBounds(10, 107, 48, 14); panel_2.add(lblDate);
In the user interface panel, a JLabel for "Sex" is positioned at coordinates (10, 132), while two JTextFields for ID and Name are created with a font size of 10 and a color of dark blue, located at (78, 27) and (78, 52) respectively Additionally, a JTextField for Place is set with a font size of 12, positioned at (79, 79) Two JRadioButtons, labeled "Male" and "Female," are included, with the Male option located at (68, 128) and the Female option at (123, 128), both featuring a light background color and grouped together for selection.
JLabel lblMath = new JLabel("Math"); lblMath.setBounds(409, 33, 48, 14); panel_2.add(lblMath);
JLabel lblPhysical = new JLabel("Physical"); lblPhysical.setBounds(409, 58, 65, 14); panel_2.add(lblPhysical);
JLabel lblChemistry = new JLabel("Chemistry"); lblChemistry.setBounds(409, 85, 65, 14); panel_2.add(lblChemistry);
JLabel lblTotal = new JLabel("Total"); lblTotal.setBounds(409, 110, 48, 14); panel_2.add(lblTotal); textField_Math = new JTextField(); textField_Math.setText("0"); textField_Math.addFocusListener(new FocusAdapter() {
@Override public void focusLost(FocusEvent arg0) { tongDiem = Double.parseDouble(textField_Math.getText()) +
Double.parseDouble(textField_Physical.getText())
+ Double.parseDouble(textField_Chemistry.getText()); textField_Total.setText(tongDiem + "");
@Override public void focusGained(FocusEvent e) { textField_Math.setText("");
The JTextField for Math is configured with a Times New Roman font, set to a plain style and size 12, featuring a dark blue color Positioned at coordinates (505, 30) with dimensions of 139 by 20 pixels, it is added to panel_2 and allows for up to 10 columns of input Additionally, a JTextField for Physical is initialized with a default text value of "0" and includes a focus listener for user interaction.
@Override public void focusLost(FocusEvent e) { tongDiem = Double.parseDouble(textField_Math.getText()) +
Double.parseDouble(textField_Physical.getText())
+ Double.parseDouble(textField_Chemistry.getText()); textField_Total.setText(tongDiem + "");
@Override public void focusGained(FocusEvent e) { textField_Physical.setText("");
The JTextField for physical data is styled with a Times New Roman font in plain style and a deep blue color, positioned at coordinates (505, 55) with a width of 139 pixels and a height of 20 pixels, allowing for 10 columns of input Additionally, a JTextField for chemistry is initialized with a default value of "0" and is equipped with a focus listener to handle user interactions.
@Override public void focusLost(FocusEvent e) { tongDiem = Double.parseDouble(textField_Math.getText()) +
Double.parseDouble(textField_Physical.getText())
+ Double.parseDouble(textField_Chemistry.getText()); textField_Total.setText(tongDiem + "");
@Override public void focusGained(FocusEvent e) { textField_Chemistry.setText("");
The chemistry input field is designed with a Times New Roman font, set to a size of 12, and features a dark blue text color Positioned at coordinates (505, 82) with dimensions 139 by 20 pixels, it allows for a maximum of 10 columns Additionally, a total text field is included, initialized with a value of "0" and is set to be non-editable This field shares the same font style and color, is located at (505, 107), and also accommodates 10 columns Both fields are integrated into panel_2 for user interaction.
String[] mangNgay = new String[31]; for (int i = 0; i < 31; i++) { mangNgay[i] = (i + 1) + "";
} comboBox_ngay = new JComboBox(mangNgay); comboBox_ngay.setBounds(78, 104, 48, 20); panel_2.add(comboBox_ngay);
String[] mangThang = new String[12]; for (int i = 0; i < 12; i++) { mangThang[i] = (i + 1) + "";
} comboBox_thang = new JComboBox(mangThang); comboBox_thang.setBounds(151, 104, 48, 20); panel_2.add(comboBox_thang);
String[] mangNam = new String[101]; for (int i = 2050; i > 1950; i ) { mangNam[2050 - i] = i + "";
} comboBox_nam = new JComboBox(mangNam); comboBox_nam.setBounds(231, 104, 58, 20); panel_2.add(comboBox_nam);
// comboBox_BirthPlace.setModel(new DefaultComboBoxModel(new String[] { "01 - An Giang", "02 - Bà Rịa - Vũng Tàu",
// "03 - Bắc Giang", "04 - Bắc Kạn", "05 - Bạc Liêu", "06 - Bắc Ninh", "07 - Bến Tre", "08 - Bình Định",
// "09 - Bình Dương", "10 - Bình Phước", "11 - Bình Thuận",
"12 - Cà Mau", "13 - Cao Bằng", "14 - Đắk Lắk",
// "15 - Đắk Nông", "16 - Điện Biên", "17 - Đồng Nai", "18 - Đồng Tháp", "19 - Gia Lai", "20 - Hà Giang",
// "21 - Hà Nam", "22 - Hà Tĩnh", "23 - Hải Dương", "24 - Hậu Giang", "25 - Hòa Bình", "26 - Hưng Yên",
// "27 - Khánh Hòa", "28 - Kiên Giang", "29 - Kon Tum", "30 - Lai Châu", "31 - Lâm Đồng", "32 - Lạng Sơn",
// "33 - Lào Cai", "34 - Long An", "35 - Nam Định", "36 - Nghệ An", "37 - Ninh Bình", "38 - Ninh Thuận",
// "39 - Phú Thọ", "40 - Quảng Bình\t", "41 - Quảng Nam", "42
// "44 - Quảng Trị", "45 - Sóc Trăng", "46 - Sơn La", "47 - Tây Ninh", "48 - Thái Bình",
// "49 - Thái Nguyên", "50 - Thanh Hóa", "51 - Thừa Thiên Huế", "52 - Tiền Giang", "53 - Trà Vinh",
// "54 - Tuyên Quang", "55 - Vĩnh Long", "56 - Vĩnh Phúc", "57
// "59 - Cần Thơ", "60 - Đà Nẵng", "61 - Hải Phòng", "62 - Hà Nội", "63 -TP HCM" }));
// panel_2.add(comboBox_BirthPlace); panel_3 = new JPanel(); panel_3.setBorder(null); panel_3.setBackground(SystemColor.desktop); panel_3.setBounds(10, 582, 654, 47);
//panel_3.setVisible(false); contentPane.add(panel_3); panel_3.setLayout(null);
The JButton labeled "INSERT" is configured with specific bounds and added to panel_3 An ActionListener is attached to the button, which triggers an action that resets various text fields, including Chemistry, Math, and Physical scores to "0", while clearing the ID and Name fields The Total field is set to "0" and made non-editable, while the other fields are enabled for user input Additionally, the date selection combo boxes and gender radio buttons are activated, and the focus is set to the ID text field, allowing panel_2 to be enabled for further interaction.
}); btnInsert.setFont(new Font("Times New Roman", Font.BOLD, 15)); btnInsert.setForeground(new Color(0, 0, 255)); btnInsert.setBackground(new Color(255, 248, 220));