SlideShare a Scribd company logo
How do I add a ComboBox to this, underneath "Enter Student ID" that says the following?
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 Submit
Solution
//Changes added to Registration class in bold text
//Registration.java
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("Student Registration",
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;
//Declare two separate labels and combo box
private JLabel buttonLabel1;
private JComboBoxcoursetBox;
private JLabel buttonLabel2;
private JButton submitButton;
public ReadPanel()
{
//Set gride layout of 3 rows and 2 columns
setLayout(new GridLayout(3,2));
//Set courses of array
String[] courses={"Select One","CS100","CS101","CS102"};
findLabel = new JLabel("Enter Student ID");
findField = new JTextField(15);
buttonLabel1 = new JLabel("Select Course");
coursetBox=new JComboBox(courses);
buttonLabel2 = new JLabel("Click to Add");
submitButton = new JButton("Submit");
submitButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
System.out.println(findField.getText());
findField.setText("");
//get text from the combo box of selected item
String courseName=(String) coursetBox.getSelectedItem();
System.out.println(courseName);
}
});
add(findLabel);add(findField);
add(buttonLabel1);add(coursetBox);
add(buttonLabel2);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);
}
}
Sample output:
Click Add Course button

More Related Content

Similar to How do I add a ComboBox to this, underneath Enter Student ID tha.pdf

import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
venkt12345
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3martha leon
 
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdfimport java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
anupambedcovers
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
sudhirchourasia86
 
Im getting List Full when I try to add 2nd student.Driver..pdf
Im getting List Full when I try to add 2nd student.Driver..pdfIm getting List Full when I try to add 2nd student.Driver..pdf
Im getting List Full when I try to add 2nd student.Driver..pdf
forwardcom41
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
arvindarora20042013
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
Iram Ramrajkar
 
How do i add a file menu to my java programSolutionHere goes .pdf
How do i add a file menu to my java programSolutionHere goes .pdfHow do i add a file menu to my java programSolutionHere goes .pdf
How do i add a file menu to my java programSolutionHere goes .pdf
fathimaoptical
 
Write a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdfWrite a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdf
fathimaoptical
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
flashfashioncasualwe
 
I hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdfI hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdf
apexelectronices01
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
forwardcom41
 
011 more swings_adv
011 more swings_adv011 more swings_adv
011 more swings_adv
Chaimaa Kabb
 

Similar to How do I add a ComboBox to this, underneath Enter Student ID tha.pdf (16)

Oop lecture9 10
Oop lecture9 10Oop lecture9 10
Oop lecture9 10
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3
 
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdfimport java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
 
Im getting List Full when I try to add 2nd student.Driver..pdf
Im getting List Full when I try to add 2nd student.Driver..pdfIm getting List Full when I try to add 2nd student.Driver..pdf
Im getting List Full when I try to add 2nd student.Driver..pdf
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
 
Oop lecture6
Oop lecture6Oop lecture6
Oop lecture6
 
Oop lecture9
Oop lecture9Oop lecture9
Oop lecture9
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
How do i add a file menu to my java programSolutionHere goes .pdf
How do i add a file menu to my java programSolutionHere goes .pdfHow do i add a file menu to my java programSolutionHere goes .pdf
How do i add a file menu to my java programSolutionHere goes .pdf
 
Write a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdfWrite a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdf
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
 
I hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdfI hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdf
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
 
011 more swings_adv
011 more swings_adv011 more swings_adv
011 more swings_adv
 

More from fathimahardwareelect

Which one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdfWhich one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdf
fathimahardwareelect
 
Which of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdfWhich of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdf
fathimahardwareelect
 
What is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdfWhat is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdf
fathimahardwareelect
 
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdfWhat mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
fathimahardwareelect
 
using the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdfusing the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdf
fathimahardwareelect
 
True or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdfTrue or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdf
fathimahardwareelect
 
True or False. If H is a subgroup of the group G then H is one of it.pdf
True or False.  If H is a subgroup of the group G then H is one of it.pdfTrue or False.  If H is a subgroup of the group G then H is one of it.pdf
True or False. If H is a subgroup of the group G then H is one of it.pdf
fathimahardwareelect
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
fathimahardwareelect
 
Immunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdfImmunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdf
fathimahardwareelect
 
Question 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdfQuestion 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdf
fathimahardwareelect
 
Question 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdfQuestion 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdf
fathimahardwareelect
 
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdfQuestion 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
fathimahardwareelect
 
List and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdfList and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdf
fathimahardwareelect
 
Please write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdfPlease write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdf
fathimahardwareelect
 
Please help me find my errors. I am lost as I know what the problem.pdf
Please help me find my errors. I am lost as I know what the problem.pdfPlease help me find my errors. I am lost as I know what the problem.pdf
Please help me find my errors. I am lost as I know what the problem.pdf
fathimahardwareelect
 
Negligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdfNegligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdf
fathimahardwareelect
 
Incuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdfIncuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdf
fathimahardwareelect
 
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdfIdentify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
fathimahardwareelect
 
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdfHow many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
fathimahardwareelect
 
How does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdfHow does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdf
fathimahardwareelect
 

More from fathimahardwareelect (20)

Which one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdfWhich one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdf
 
Which of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdfWhich of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdf
 
What is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdfWhat is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdf
 
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdfWhat mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
 
using the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdfusing the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdf
 
True or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdfTrue or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdf
 
True or False. If H is a subgroup of the group G then H is one of it.pdf
True or False.  If H is a subgroup of the group G then H is one of it.pdfTrue or False.  If H is a subgroup of the group G then H is one of it.pdf
True or False. If H is a subgroup of the group G then H is one of it.pdf
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
 
Immunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdfImmunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdf
 
Question 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdfQuestion 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdf
 
Question 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdfQuestion 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdf
 
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdfQuestion 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
 
List and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdfList and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdf
 
Please write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdfPlease write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdf
 
Please help me find my errors. I am lost as I know what the problem.pdf
Please help me find my errors. I am lost as I know what the problem.pdfPlease help me find my errors. I am lost as I know what the problem.pdf
Please help me find my errors. I am lost as I know what the problem.pdf
 
Negligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdfNegligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdf
 
Incuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdfIncuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdf
 
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdfIdentify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
 
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdfHow many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
 
How does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdfHow does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdf
 

Recently uploaded

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 

Recently uploaded (20)

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 

How do I add a ComboBox to this, underneath Enter Student ID tha.pdf

  • 1. How do I add a ComboBox to this, underneath "Enter Student ID" that says the following? 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) {
  • 2. 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);
  • 3. 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);
  • 4. 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 Submit Solution //Changes added to Registration class in bold text //Registration.java 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");
  • 5. 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("Student Registration", 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){ } });
  • 6. bar.add(fileMenu); bar.add(tuitionMenu); bar.add(exitMenu); setJMenuBar(bar); add(theDesktop); } public class ReadPanel extends Panel{ private JLabel findLabel; private JTextField findField; //Declare two separate labels and combo box private JLabel buttonLabel1; private JComboBoxcoursetBox; private JLabel buttonLabel2; private JButton submitButton; public ReadPanel() { //Set gride layout of 3 rows and 2 columns setLayout(new GridLayout(3,2)); //Set courses of array String[] courses={"Select One","CS100","CS101","CS102"}; findLabel = new JLabel("Enter Student ID"); findField = new JTextField(15); buttonLabel1 = new JLabel("Select Course"); coursetBox=new JComboBox(courses); buttonLabel2 = new JLabel("Click to Add"); submitButton = new JButton("Submit"); submitButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ System.out.println(findField.getText()); findField.setText(""); //get text from the combo box of selected item String courseName=(String) coursetBox.getSelectedItem(); System.out.println(courseName);
  • 7. } }); add(findLabel);add(findField); add(buttonLabel1);add(coursetBox); add(buttonLabel2);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); } } Sample output: Click Add Course button