SlideShare a Scribd company logo
1 of 6
Download to read offline
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.pdffeetshoemart
 
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.pdfsales98
 
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.pdffathimahardwareelect
 
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.pdfarvindarora20042013
 
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.pdfizabellejaeden956
 
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.pdfsudhirchourasia86
 
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.pdfbermanbeancolungak45
 
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.docxdelicecogupdyke
 
Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3Ejemplos Interfaces Usuario 3
Ejemplos Interfaces Usuario 3martha 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.pdficonsystemsslm
 

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.pdffedosys
 
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 .pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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..pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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 .pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 
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.pdffedosys
 

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

e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 

Recently uploaded (20)

e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 

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