SlideShare a Scribd company logo
Here is the given code, and the things I need to be done. I've posted this about 3 times and
nobody has helped me yet..
import javax.swing.*;
import java.awt.event.*;
public class JavaMenus extends JFrame {
public JavaMenus()
{
super("Java Menu Example");
JMenu file = new JMenu("File");
file.setMnemonic('F');
JMenuItem ItemNew = new JMenuItem("New");
ItemNew.setMnemonic('N');
file.add(ItemNew);
JLabel fileButton = new JLabel(new ImageIcon("dukejdk"));
JMenuItem ItemOpen = new JMenuItem("Open");
ItemOpen.setMnemonic('O');
file.add(ItemOpen);
JMenuItem ItemExit = new JMenuItem("Exit");
ItemExit.setMnemonic('x');
file.add(ItemExit);
final JLabel label1 = new JLabel(" Welcome");
add(label1);
this.setSize(100, 100);
setVisible(true);
ItemNew.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
{
label1.setText(" New");
JOptionPane.showMessageDialog(null, "New was Clicked",
"Result", JOptionPane.PLAIN_MESSAGE);
}
}
);
ItemOpen.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
label1.setText(" Open");
JOptionPane.showMessageDialog(null, "Open was Clicked",
"Result", JOptionPane.PLAIN_MESSAGE);
}
}
);
ItemExit.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
label1.setText(" Exit");
JOptionPane.showMessageDialog(null, "Exit was Clicked",
"Result", JOptionPane.PLAIN_MESSAGE);
}
}
);
JMenuBar bar = new JMenuBar();
setJMenuBar(bar);
bar.add(file);
getContentPane();
setSize(250, 250);
setVisible(true);
}
public static void main(String[] args)
{
JavaMenus appMenu = new JavaMenus();
appMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Modify your program code for the JavaMenus.java file such that the program will include
a new menu item. To do this alter the menu component items scheme to appear as follows.
Open Item
A Graphic image appears drawn out in the Frame
New Item
A historical quote appears in the Frame along with a corresponding image related to the quote.
Example- picture of Steve Jobs along with a Jobs quote of sorts.
Edit Item
A message box appears with the user’s name.
Exit Item
The application exits.
Test your modified program.
STEP 5 Supplement the Program Code
Modify again your program code for the JavaMenus.java file such that the program will
include a new second column of menu items. To do this alter the menu bar such that it
will contain these items.
Welcome Item
A message box appears that describes the program.
About Item
A message box appears with your name, as the programmer and version number of the app.
Open Item
A Graphic image appears drawn out in the Frame
New Item
A historical quote appears in the Frame along with a corresponding image related to the quote.
Example- picture of Steve Jobs along with a Jobs quote of sorts.
Edit Item
A message box appears with the user’s name.
Exit Item
The application exits.
Solution
package test;
import javax.swing.*;
import java.awt.event.*;
import java.io.File;
public class JavaMenus extends JFrame {
public JavaMenus()
{
super("Java Menu Example");
JMenu file = new JMenu("File");
file.setMnemonic('F');
JMenuItem ItemNew = new JMenuItem("New");
ItemNew.setMnemonic('N');
file.add(ItemNew);
JMenuItem ItemOpen = new JMenuItem("Open");
ItemOpen.setMnemonic('O');
file.add(ItemOpen);
JMenuItem ItemExit = new JMenuItem("Exit");
ItemExit.setMnemonic('x');
file.add(ItemExit);
final JLabel label1 = new JLabel(" Welcome");
add(label1);
this.setSize(100, 100);
setVisible(true);
ItemNew.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
{
label1.setText(" New");
setContentPane(new JLabel("Stay Hungry,Stay Foolish"));
setContentPane(new JLabel(new
ImageIcon("C:UsersComputerDownloadssteve.jpg")));
JOptionPane.showMessageDialog(null, "Stay Hungry,Stay Foolish",
"Result", JOptionPane.PLAIN_MESSAGE);
}
}
);
ItemOpen.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
label1.setText(" Open");
JFileChooser chooser=new JFileChooser();
int returnVal = chooser.showOpenDialog(new JFrame());
File file=chooser.getSelectedFile();
setContentPane(new JLabel(new ImageIcon(file.getAbsolutePath())));
}
}
);
ItemExit.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
label1.setText(" Exit");
JOptionPane.showMessageDialog(null, "Exit was Clicked",
"Result", JOptionPane.PLAIN_MESSAGE);
}
}
);
JMenuBar bar = new JMenuBar();
setJMenuBar(bar);
bar.add(file);
getContentPane();
setSize(250, 250);
setVisible(true);
}
public static void main(String[] args)
{
JavaMenus appMenu = new JavaMenus();
appMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
don't know about what you mean by edit item

More Related Content

Similar to Here is the given code, and the things I need to be done. Ive post.pdf

This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdf
feetshoemart
 
Swings in java
Swings in javaSwings in java
Swings in java
Jyoti Totla
 
I need help with this Java assignment. Please include comments throu.pdf
I need help with this Java assignment. Please include comments throu.pdfI need help with this Java assignment. Please include comments throu.pdf
I need help with this Java assignment. Please include comments throu.pdf
sales98
 
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdfHow do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
fathimahardwareelect
 
Java Assignment Help
Java Assignment HelpJava Assignment Help
Java Assignment Help
Programming Assignments
 
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergrationSpring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
Carlos Junior Caso Casimiro
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
Yuichi Sakuraba
 
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
 
Swing
SwingSwing
Write an application containing three parallel arrays that hold 10 e.pdf
Write an application containing three parallel arrays that hold 10 e.pdfWrite an application containing three parallel arrays that hold 10 e.pdf
Write an application containing three parallel arrays that hold 10 e.pdf
izabellejaeden956
 
CORE JAVA-2
CORE JAVA-2CORE JAVA-2
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
 
Convert the following program so that it uses JList instead of JComb.pdf
Convert the following program so that it uses JList instead of JComb.pdfConvert the following program so that it uses JList instead of JComb.pdf
Convert the following program so that it uses JList instead of JComb.pdf
bermanbeancolungak45
 
TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2
Lokesh Singrol
 
Hello I need helo with my Java array question for computer science 161.docx
Hello I need helo with my Java array question for computer science 161.docxHello I need helo with my Java array question for computer science 161.docx
Hello I need helo with my Java array question for computer science 161.docx
delicecogupdyke
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
Tareq Hasan
 
11basic Swing
11basic Swing11basic Swing
11basic Swing
Adil Jafri
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3
martha leon
 
Working with the Calculator program Once imported run the.pdf
Working with the Calculator program Once imported  run the.pdfWorking with the Calculator program Once imported  run the.pdf
Working with the Calculator program Once imported run the.pdf
iconsystemsslm
 
Basic swing
Basic swingBasic swing
Basic swing
bharathi120789
 

Similar to Here is the given code, and the things I need to be done. Ive post.pdf (20)

This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdf
 
Swings in java
Swings in javaSwings in java
Swings in java
 
I need help with this Java assignment. Please include comments throu.pdf
I need help with this Java assignment. Please include comments throu.pdfI need help with this Java assignment. Please include comments throu.pdf
I need help with this Java assignment. Please include comments throu.pdf
 
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdfHow do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
 
Java Assignment Help
Java Assignment HelpJava Assignment Help
Java Assignment Help
 
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergrationSpring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
 
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
 
Swing
SwingSwing
Swing
 
Write an application containing three parallel arrays that hold 10 e.pdf
Write an application containing three parallel arrays that hold 10 e.pdfWrite an application containing three parallel arrays that hold 10 e.pdf
Write an application containing three parallel arrays that hold 10 e.pdf
 
CORE JAVA-2
CORE JAVA-2CORE JAVA-2
CORE JAVA-2
 
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
 
Convert the following program so that it uses JList instead of JComb.pdf
Convert the following program so that it uses JList instead of JComb.pdfConvert the following program so that it uses JList instead of JComb.pdf
Convert the following program so that it uses JList instead of JComb.pdf
 
TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2
 
Hello I need helo with my Java array question for computer science 161.docx
Hello I need helo with my Java array question for computer science 161.docxHello I need helo with my Java array question for computer science 161.docx
Hello I need helo with my Java array question for computer science 161.docx
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
11basic Swing
11basic Swing11basic Swing
11basic Swing
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3
 
Working with the Calculator program Once imported run the.pdf
Working with the Calculator program Once imported  run the.pdfWorking with the Calculator program Once imported  run the.pdf
Working with the Calculator program Once imported run the.pdf
 
Basic swing
Basic swingBasic swing
Basic swing
 

More from fedosys

If messages are being sent from your email account without your know.pdf
If messages are being sent from your email account without your know.pdfIf messages are being sent from your email account without your know.pdf
If messages are being sent from your email account without your know.pdf
fedosys
 
Identify some of the postmodern trends movements that women artist .pdf
Identify some of the postmodern trends movements that women artist .pdfIdentify some of the postmodern trends movements that women artist .pdf
Identify some of the postmodern trends movements that women artist .pdf
fedosys
 
i need the executable file of this program (.exe) This is Assembly.pdf
i need the executable file of this program (.exe) This is Assembly.pdfi need the executable file of this program (.exe) This is Assembly.pdf
i need the executable file of this program (.exe) This is Assembly.pdf
fedosys
 
Help me fix the error shown above in my code of image.cpp please~I.pdf
Help me fix the error shown above in my code of image.cpp please~I.pdfHelp me fix the error shown above in my code of image.cpp please~I.pdf
Help me fix the error shown above in my code of image.cpp please~I.pdf
fedosys
 
Explain how the format of the mark-up language differs from the docu.pdf
Explain how the format of the mark-up language differs from the docu.pdfExplain how the format of the mark-up language differs from the docu.pdf
Explain how the format of the mark-up language differs from the docu.pdf
fedosys
 
Each student in my class was given bodily fluids. Everyone was n.pdf
Each student in my class was given bodily fluids. Everyone was n.pdfEach student in my class was given bodily fluids. Everyone was n.pdf
Each student in my class was given bodily fluids. Everyone was n.pdf
fedosys
 
Hello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdfHello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdf
fedosys
 
Describe the attributes that make a vision meaningful to stakeholder.pdf
Describe the attributes that make a vision meaningful to stakeholder.pdfDescribe the attributes that make a vision meaningful to stakeholder.pdf
Describe the attributes that make a vision meaningful to stakeholder.pdf
fedosys
 
Create a C program which auto-completes suggestions when beginning t.pdf
Create a C program which auto-completes suggestions when beginning t.pdfCreate a C program which auto-completes suggestions when beginning t.pdf
Create a C program which auto-completes suggestions when beginning t.pdf
fedosys
 
Compare the DHCP and DHCPv6SolutionThe comparison between the .pdf
Compare the DHCP and DHCPv6SolutionThe comparison between the .pdfCompare the DHCP and DHCPv6SolutionThe comparison between the .pdf
Compare the DHCP and DHCPv6SolutionThe comparison between the .pdf
fedosys
 
Consider in a given economy For a given time period the following in.pdf
Consider in a given economy For a given time period the following in.pdfConsider in a given economy For a given time period the following in.pdf
Consider in a given economy For a given time period the following in.pdf
fedosys
 
Background Many cities such as Detroit, MI have been in the news re.pdf
Background Many cities such as Detroit, MI have been in the news re.pdfBackground Many cities such as Detroit, MI have been in the news re.pdf
Background Many cities such as Detroit, MI have been in the news re.pdf
fedosys
 
Can someone put this code in a zip file. I tried running it last tim.pdf
Can someone put this code in a zip file. I tried running it last tim.pdfCan someone put this code in a zip file. I tried running it last tim.pdf
Can someone put this code in a zip file. I tried running it last tim.pdf
fedosys
 
Assignment 1. List the three visual elements Brieny descrbe each. 2 W.pdf
Assignment 1. List the three visual elements Brieny descrbe each. 2 W.pdfAssignment 1. List the three visual elements Brieny descrbe each. 2 W.pdf
Assignment 1. List the three visual elements Brieny descrbe each. 2 W.pdf
fedosys
 
A. Intergenic sequences make up 60 of the human genome. Where do t.pdf
A. Intergenic sequences make up 60 of the human genome. Where do t.pdfA. Intergenic sequences make up 60 of the human genome. Where do t.pdf
A. Intergenic sequences make up 60 of the human genome. Where do t.pdf
fedosys
 
a) How can habitat selection and sexual selection drive sympatric sp.pdf
a) How can habitat selection and sexual selection drive sympatric sp.pdfa) How can habitat selection and sexual selection drive sympatric sp.pdf
a) How can habitat selection and sexual selection drive sympatric sp.pdf
fedosys
 
A common test of balances in a revenue cycle is the inquiry of manage.pdf
A common test of balances in a revenue cycle is the inquiry of manage.pdfA common test of balances in a revenue cycle is the inquiry of manage.pdf
A common test of balances in a revenue cycle is the inquiry of manage.pdf
fedosys
 
7. Recently, Skooterville has experienced a large growth in populati.pdf
7. Recently, Skooterville has experienced a large growth in populati.pdf7. Recently, Skooterville has experienced a large growth in populati.pdf
7. Recently, Skooterville has experienced a large growth in populati.pdf
fedosys
 
50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf
50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf
50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf
fedosys
 
4. For each of the following electrochemical cells i. Identify the a.pdf
4. For each of the following electrochemical cells i. Identify the a.pdf4. For each of the following electrochemical cells i. Identify the a.pdf
4. For each of the following electrochemical cells i. Identify the a.pdf
fedosys
 

More from fedosys (20)

If messages are being sent from your email account without your know.pdf
If messages are being sent from your email account without your know.pdfIf messages are being sent from your email account without your know.pdf
If messages are being sent from your email account without your know.pdf
 
Identify some of the postmodern trends movements that women artist .pdf
Identify some of the postmodern trends movements that women artist .pdfIdentify some of the postmodern trends movements that women artist .pdf
Identify some of the postmodern trends movements that women artist .pdf
 
i need the executable file of this program (.exe) This is Assembly.pdf
i need the executable file of this program (.exe) This is Assembly.pdfi need the executable file of this program (.exe) This is Assembly.pdf
i need the executable file of this program (.exe) This is Assembly.pdf
 
Help me fix the error shown above in my code of image.cpp please~I.pdf
Help me fix the error shown above in my code of image.cpp please~I.pdfHelp me fix the error shown above in my code of image.cpp please~I.pdf
Help me fix the error shown above in my code of image.cpp please~I.pdf
 
Explain how the format of the mark-up language differs from the docu.pdf
Explain how the format of the mark-up language differs from the docu.pdfExplain how the format of the mark-up language differs from the docu.pdf
Explain how the format of the mark-up language differs from the docu.pdf
 
Each student in my class was given bodily fluids. Everyone was n.pdf
Each student in my class was given bodily fluids. Everyone was n.pdfEach student in my class was given bodily fluids. Everyone was n.pdf
Each student in my class was given bodily fluids. Everyone was n.pdf
 
Hello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdfHello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdf
 
Describe the attributes that make a vision meaningful to stakeholder.pdf
Describe the attributes that make a vision meaningful to stakeholder.pdfDescribe the attributes that make a vision meaningful to stakeholder.pdf
Describe the attributes that make a vision meaningful to stakeholder.pdf
 
Create a C program which auto-completes suggestions when beginning t.pdf
Create a C program which auto-completes suggestions when beginning t.pdfCreate a C program which auto-completes suggestions when beginning t.pdf
Create a C program which auto-completes suggestions when beginning t.pdf
 
Compare the DHCP and DHCPv6SolutionThe comparison between the .pdf
Compare the DHCP and DHCPv6SolutionThe comparison between the .pdfCompare the DHCP and DHCPv6SolutionThe comparison between the .pdf
Compare the DHCP and DHCPv6SolutionThe comparison between the .pdf
 
Consider in a given economy For a given time period the following in.pdf
Consider in a given economy For a given time period the following in.pdfConsider in a given economy For a given time period the following in.pdf
Consider in a given economy For a given time period the following in.pdf
 
Background Many cities such as Detroit, MI have been in the news re.pdf
Background Many cities such as Detroit, MI have been in the news re.pdfBackground Many cities such as Detroit, MI have been in the news re.pdf
Background Many cities such as Detroit, MI have been in the news re.pdf
 
Can someone put this code in a zip file. I tried running it last tim.pdf
Can someone put this code in a zip file. I tried running it last tim.pdfCan someone put this code in a zip file. I tried running it last tim.pdf
Can someone put this code in a zip file. I tried running it last tim.pdf
 
Assignment 1. List the three visual elements Brieny descrbe each. 2 W.pdf
Assignment 1. List the three visual elements Brieny descrbe each. 2 W.pdfAssignment 1. List the three visual elements Brieny descrbe each. 2 W.pdf
Assignment 1. List the three visual elements Brieny descrbe each. 2 W.pdf
 
A. Intergenic sequences make up 60 of the human genome. Where do t.pdf
A. Intergenic sequences make up 60 of the human genome. Where do t.pdfA. Intergenic sequences make up 60 of the human genome. Where do t.pdf
A. Intergenic sequences make up 60 of the human genome. Where do t.pdf
 
a) How can habitat selection and sexual selection drive sympatric sp.pdf
a) How can habitat selection and sexual selection drive sympatric sp.pdfa) How can habitat selection and sexual selection drive sympatric sp.pdf
a) How can habitat selection and sexual selection drive sympatric sp.pdf
 
A common test of balances in a revenue cycle is the inquiry of manage.pdf
A common test of balances in a revenue cycle is the inquiry of manage.pdfA common test of balances in a revenue cycle is the inquiry of manage.pdf
A common test of balances in a revenue cycle is the inquiry of manage.pdf
 
7. Recently, Skooterville has experienced a large growth in populati.pdf
7. Recently, Skooterville has experienced a large growth in populati.pdf7. Recently, Skooterville has experienced a large growth in populati.pdf
7. Recently, Skooterville has experienced a large growth in populati.pdf
 
50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf
50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf
50mL of a 0.1000 M aqueous solution of hydrazoic acid (HN3, Ka=1.91.pdf
 
4. For each of the following electrochemical cells i. Identify the a.pdf
4. For each of the following electrochemical cells i. Identify the a.pdf4. For each of the following electrochemical cells i. Identify the a.pdf
4. For each of the following electrochemical cells i. Identify the a.pdf
 

Recently uploaded

Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 

Recently uploaded (20)

Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 

Here is the given code, and the things I need to be done. Ive post.pdf

  • 1. Here is the given code, and the things I need to be done. I've posted this about 3 times and nobody has helped me yet.. import javax.swing.*; import java.awt.event.*; public class JavaMenus extends JFrame { public JavaMenus() { super("Java Menu Example"); JMenu file = new JMenu("File"); file.setMnemonic('F'); JMenuItem ItemNew = new JMenuItem("New"); ItemNew.setMnemonic('N'); file.add(ItemNew); JLabel fileButton = new JLabel(new ImageIcon("dukejdk")); JMenuItem ItemOpen = new JMenuItem("Open"); ItemOpen.setMnemonic('O'); file.add(ItemOpen); JMenuItem ItemExit = new JMenuItem("Exit"); ItemExit.setMnemonic('x'); file.add(ItemExit); final JLabel label1 = new JLabel(" Welcome"); add(label1); this.setSize(100, 100); setVisible(true); ItemNew.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { label1.setText(" New"); JOptionPane.showMessageDialog(null, "New was Clicked", "Result", JOptionPane.PLAIN_MESSAGE); } } ); ItemOpen.addActionListener(
  • 2. new ActionListener(){ public void actionPerformed(ActionEvent e) { label1.setText(" Open"); JOptionPane.showMessageDialog(null, "Open was Clicked", "Result", JOptionPane.PLAIN_MESSAGE); } } ); ItemExit.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e) { label1.setText(" Exit"); JOptionPane.showMessageDialog(null, "Exit was Clicked", "Result", JOptionPane.PLAIN_MESSAGE); } } ); JMenuBar bar = new JMenuBar(); setJMenuBar(bar); bar.add(file); getContentPane(); setSize(250, 250); setVisible(true); } public static void main(String[] args) { JavaMenus appMenu = new JavaMenus(); appMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Modify your program code for the JavaMenus.java file such that the program will include a new menu item. To do this alter the menu component items scheme to appear as follows.
  • 3. Open Item A Graphic image appears drawn out in the Frame New Item A historical quote appears in the Frame along with a corresponding image related to the quote. Example- picture of Steve Jobs along with a Jobs quote of sorts. Edit Item A message box appears with the user’s name. Exit Item The application exits. Test your modified program. STEP 5 Supplement the Program Code Modify again your program code for the JavaMenus.java file such that the program will include a new second column of menu items. To do this alter the menu bar such that it will contain these items. Welcome Item A message box appears that describes the program. About Item A message box appears with your name, as the programmer and version number of the app. Open Item A Graphic image appears drawn out in the Frame New Item A historical quote appears in the Frame along with a corresponding image related to the quote. Example- picture of Steve Jobs along with a Jobs quote of sorts. Edit Item A message box appears with the user’s name. Exit Item The application exits. Solution
  • 4. package test; import javax.swing.*; import java.awt.event.*; import java.io.File; public class JavaMenus extends JFrame { public JavaMenus() { super("Java Menu Example"); JMenu file = new JMenu("File"); file.setMnemonic('F'); JMenuItem ItemNew = new JMenuItem("New"); ItemNew.setMnemonic('N'); file.add(ItemNew); JMenuItem ItemOpen = new JMenuItem("Open"); ItemOpen.setMnemonic('O'); file.add(ItemOpen); JMenuItem ItemExit = new JMenuItem("Exit"); ItemExit.setMnemonic('x'); file.add(ItemExit); final JLabel label1 = new JLabel(" Welcome"); add(label1); this.setSize(100, 100); setVisible(true); ItemNew.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { label1.setText(" New"); setContentPane(new JLabel("Stay Hungry,Stay Foolish")); setContentPane(new JLabel(new ImageIcon("C:UsersComputerDownloadssteve.jpg"))); JOptionPane.showMessageDialog(null, "Stay Hungry,Stay Foolish", "Result", JOptionPane.PLAIN_MESSAGE);
  • 5. } } ); ItemOpen.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e) { label1.setText(" Open"); JFileChooser chooser=new JFileChooser(); int returnVal = chooser.showOpenDialog(new JFrame()); File file=chooser.getSelectedFile(); setContentPane(new JLabel(new ImageIcon(file.getAbsolutePath()))); } } ); ItemExit.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e) { label1.setText(" Exit"); JOptionPane.showMessageDialog(null, "Exit was Clicked", "Result", JOptionPane.PLAIN_MESSAGE); } } ); JMenuBar bar = new JMenuBar(); setJMenuBar(bar); bar.add(file); getContentPane(); setSize(250, 250); setVisible(true); } public static void main(String[] args) {
  • 6. JavaMenus appMenu = new JavaMenus(); appMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } don't know about what you mean by edit item