Question
How do I add a ComboBox to this, underneath Enter Student ID that says the following? package writefiles; import java.awt.*; import java.awt.event.*; import javax.swing.*; import
How do I add a ComboBox to this, underneath "Enter Student ID" that says the following?
package writefiles;
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*;
public class Registration extends JFrame { private JDesktopPane theDesktop; public Registration(){ theDesktop = new JDesktopPane(); JMenuBar bar = new JMenuBar(); JMenu fileMenu = new JMenu("Course"); JMenuItem addCourseItem = new JMenuItem("Add Course"); fileMenu.add(addCourseItem); JMenu tuitionMenu = new JMenu("Tuition"); JMenuItem calculateItem = new JMenuItem("Calculate Tuition"); JMenuItem printTuitionItem = new JMenuItem("Print Tuition"); JMenuItem printSchedulesItem = new JMenuItem("Print Student Schedules"); tuitionMenu.add(calculateItem); tuitionMenu.add(printTuitionItem); tuitionMenu.add(printSchedulesItem); JMenu exitMenu = new JMenu("Exit"); JMenuItem exitProgramItem = new JMenuItem("Exit Program"); exitMenu.add(exitProgramItem); addCourseItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae) { JInternalFrame frame = new JInternalFrame("Enter Student ID", true, true, true, true); ReadPanel rp = new ReadPanel(); frame.add(rp); frame.pack(); theDesktop.add(frame); frame.setVisible(true); } }); exitProgramItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ System.exit(0); } }); calculateItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ } }); printTuitionItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ } }); printSchedulesItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ } }); bar.add(fileMenu); bar.add(tuitionMenu); bar.add(exitMenu); setJMenuBar(bar); add(theDesktop); } public class ReadPanel extends Panel{ private JLabel findLabel; private JTextField findField; private JLabel buttonLabel; private JButton submitButton; public ReadPanel(){ findLabel = new JLabel("Enter Student ID"); findField = new JTextField(15); buttonLabel = new JLabel("Select Course"); buttonLabel = new JLabel("Click to Add"); submitButton = new JButton("Submit"); setLayout(new GridLayout(2,2)); submitButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ System.out.println(findField.getText()); findField.setText(""); } }); add(findLabel); add(findField); add(buttonLabel); add(buttonLabel); add(submitButton); } } public static void main(String[] args){ Registration r1 = new Registration(); r1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); r1.setLocationRelativeTo(null); r1.setSize(400,400); r1.setVisible(true); } }
Registration System Course Tuition Exit Course Panel Enter Student ID Select Course Click to Add Select One SubmitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started