Homework

Homework Questions? Ask a Tutor for Answers ASAP

Ask an Expert,
Get an Answer ASAP!

This answer was rated:

JAVA program (Net Beans) Create frame from JFrame Design…

JAVA program (Net Beans)...
JAVA program (Net Beans)
Create frame from JFrame

Design a class called MyJFrame to produce output as shown in Figures 1 – 7. This frame must be inherited from the class JFrame. The frame must contain only a title as shown in Figure 1

Figure 1

Create a menu bar object and set it in place. Add menu choices onto the menu bar as shown in Figure 2.



Figure 2

Add menu items to each menu choice as shown in Figure 3 and Figure 4. Place separators where indicated in the Figures.
.


Figure 3

For the menu choice Tools, create a cascading menu for the menu choice Edit. This submenu must contain menu items as shown in the Figure 4.



Figure 4

The following is an outline of the code for the class MyJFrame. You may consult your notes and class handouts for further information.

1. Use an interface to maintain constant values and generic methods
2. Use arrays to contain:
(a) The list of menu choices
(b) The list of menu items for the menu choices – File, Tool, and Edit.

// Area reserve for importing classes.

class MyJFrame extends JFrame
{
JMenuBar mbar;
JMenu jm;
JMenuItem mi;

MyJFrame(String title)
{
super(title);

mbar = new JMenuBar(); //Create menu bar and set it
setJMenuBar(mbar);

buildMenu(); // Call method which actually builds the menu
}

void buildMenu()
{
for (int i = 0; i <Constants. MENU.length; i++) // For each menu choice, create a menu choice object
{
jm = new JMenu(Constants.MENU);

/* Determine the menu choice and create menu items for each menu
* choice and add each set of menu items to its respective menu choice
*/
switch(i)
{
case 0: // File
//Create separator or create file menu item and add each to the menu choice

break;

case 1: //Tool
/* First, check for the string Edit. When found, use it to create a sub menu
object. Next, create menu items, in this case – Copy and Paste as menu
items. Add these menu items to the sub menu. Finally, add this sub menu to
the menu choice Tool.
If the string is not Edit, then it must be a menu item for menu choice Tool.
Create each menu item objects, in this case – Sort and Search, and add each
to the menu choice Tool.
*/

break;

case 2: // Help, at this point no menu item will be attached
break;

default: // No action taken at this time
break;
}// End switch
mbar.add(jm); // Add each menu choice with its menu items to the menu bar.
}// End for
}// End build
}// End class MyJFrame


Part II

Additing Functionality to your GUI

Create an anonymous WindowListener class such that when you click the close button on your frame, a child frame (JOptionPane frame) appears, similar to Figure 5 Remember to import the class WindowAdapter and the class WindowEvent.




Figure 5


Go to the class MyJFrame and register each menu item to the ActionListener object. The general format is:

mi.addActionListener(new Actions());

where the class Actions is partially defined below

The class Actions determines which menu item has been activated. The general format of this class is as follows:

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

class Actions implements ActionListener
{
DisplayText dt;

public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equalsIgnoreCase("New"))
{
dt = new DisplayText("Untitled..... ", "");
}
else if(e.getActionCommand().equalsIgnoreCase("Open"))
{
BasicFile f = new BasicFile();
f.selectFile();
dt = new DisplayText(f.getName(), f.getContent());
}
//::::::::::::
else
;

/*
*
*::::::::::::::::::::::::
*
*/
}
}

(b) Implement the class DisplayText that was given to you. This class accepts two strings - the first represents the name of a file and the second string, the contents of the file. This class constructs a frame object from the class MyJFrame accepts the first string which is used as a title. Place the second string is the text to be displayed in a JScrollPane.

(c) Use the class called BasicFile from Assignment 4. This file uses the FileChooser class to create a File dialog. At this point the three most important methods are:
• selectFile() which creates the file dialog, from which you can select a file.
• getName() returns the name of the file you selected
• getContents() returns the contents of the file you selected.


Running the Program

When you run the program and select File – New, your output should be similar to Figure 6.



Figure 6


Similarly, when you select File – Open, your output should be similar to Figure 7.



Figure 7

This should be familiar to you. If you select a file its contents would be displayed as shown in Figure 8.


Figure 8

• Implement the Copy - Paste options. That is use the mouse to highlight a portion of the displayed text, and copy it to a different location in the document.


Part III
Adding buttons to the frame.
Show More
Show Less
Ask Your Own Homework Question
Answered in 9 minutes by:
4/22/2013
ATLProg
ATLProg, Software Engineer
Category: Homework
Satisfied Customers: 9,151
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified
Hello welcome i can assist you with your program. I am ATLProg
Can you please let me know by when you need this done?
Ask Your Own Homework Question
Customer reply replied 5 years ago

It must be completed by: Wednesday April 24th by 11:00 PM


 

Can you please send me a pdf/word document/URL of your assignment description ?
Can you please send me the files you have been working with ?
Can you please go to www.ge.tt and upload your file ? Once you do that you will get a page that has the "Download Link". Copy the "Download Link" and please paste it in your reply here.
Ask Your Own Homework Question
Customer reply replied 5 years ago

link with assignment instructions: http://ge.tt/19xDyme/v/0?c


 


link with files i have been working with: http://ge.tt/5QWK0ne?c


 

ok let me seee
Ask Your Own Homework Question
I have sent a Underpriced report on this to your registered email id, please confirm if the price looks ok to you. Please let me know so I can start working on this accordingly.
Ask Your Own Homework Question
Customer reply replied 5 years ago

The price looks okay to me.

This answer is protected
Would you like to ask this question?
If you've already paid for this answer, simply Login.
ATLProg
ATLProg, Software Engineer
Category: Homework
Satisfied Customers: 9,151
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
Verified
ATLProg and 87 other Homework Specialists are ready to help you
Ask your own question now
Did it work ? Do you have any questions ? Concerns ?
Ask Your Own Homework Question
Please add the difference of amounts as agreed upon per underpriced report as bonus/tip when you Rate answer. You should see a button add bonus/tip .
Ask Your Own Homework Question
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a tutorLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask ATLProg Your Own Question
ATLProg
ATLProg
ATLProg, Software Engineer
Category: Homework
Satisfied Customers: 9,151
9,151 Satisfied Customers
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML

ATLProg is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.

DianeDallas, TX

< Previous | Next >

Meet the Experts:

LogicPro

LogicPro

Engineer

5,867 satisfied customers

Expert in Java C++ C C# VB Javascript Design SQL HTML

Manal Elkhoshkhany

Manal Elkhoshkhany

Tutor

4,556 satisfied customers

More than 5000 online tutoring sessions.

Linda_us

Linda_us

Finance, Accounts & Homework Tutor

3,138 satisfied customers

Post Graduate Diploma in Management (MBA)

Chris M.

Chris M.

M.S.W. Social Work

2,698 satisfied customers

Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

F. Naz

F. Naz

Chartered Accountant

2,190 satisfied customers

Experience with chartered accountancy

Bizhelp

Bizhelp

CPA

1,887 satisfied customers

Bachelors Degree and CPA with Accounting work experience

Seanna

Seanna

Tutor

1,781 satisfied customers

3,000+ satisfied customers, all topics, A+ work

< Previous | Next >

Related Homework Questions
My calculations (see uploaded spreadsheet) do exactly what I
My calculations (see uploaded spreadsheet) do exactly what I want. My problem is controlling what the user sees. I want different portions of the worksheet to appear or disappear, depending upon choic… read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
416 satisfied customers
I need answers to my homework questions and I need to submit
I need answers to my homework questions and I need to submit by today 11:59 pm and I am looking for help. I really need this cause I am way behind in assignments. … read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
For LogicPro only Purpose: Use a Priority_queue to simulate
For LogicPro onlyPurpose: Use a Priority_queue to simulate a Binary_TreeTechniques/Structures: Polymorphism, SmartPointers, Priority_Queue, LambdasStep1: Create a frequency table of ascii characters b… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
1. If a 2:1 transformer has a 220 VAC input, a voltage test
1. If a 2:1 transformer has a 220 VAC input, a voltage test at the primary winding should produce a meter reading of A. 0 VAC. B. 110 VAC. C. 220 VAC. D. 440 VAC. 2. A circuit contains four 100 Ω resi… read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
Create an Io program that duplicates the Java example
For Logic Pro onlyCreate an Io program that duplicates the Java example SortedList.java, in both functionality and object-oriented design It is assumed that your program can be run like this: io Sorte… read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
The project consist of a set of data with three independent
The project consist of a set of data with three independent questions.1. Create a histogram or bar graph for some variable categorized by age and split for men and women. This extends the idea of bar … read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
416 satisfied customers
I need this Project Answer by 6:00 pm today June 19 2018,
I need this Project Answer by 6:00 pm today June 19 2018, and I would like to be notified if a writer would take the question. If Writer Grace is available I would like her if not anyone can take it.U… read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
416 satisfied customers
I need answers for my associates accounting exams,
Hi JA: Hello. How can I help? Customer: I need answers for my associates accounting exams JA: The Tutor can help you get an A on your homework or ace your next test. Tell me more about what you need h… read more
Manal Elkhoshkhany
Manal Elkhoshkhany
Tutor
4,556 satisfied customers
What is the answer? Nonparametric statistics requires a
What is the answer ? Nonparametric statistics requires a larger sample size because of ? a. Sensivity B.range of scores C.variance D.power… read more
GLENN GILONGOS
GLENN GILONGOS
Master of Mathematics
416 satisfied customers
I have a requirement to write an Oracle PL/SQL code to
I have a requirement to write an Oracle PL/SQL code to delete about 9 billion records in small batches of 10,000. The procedure should run quasi permanently (loop/sleep) and must backup (log/copy) the… read more
Bruce Wilner
Bruce Wilner
Master of Engineering
29 satisfied customers
I need help creating an excel formula (i'm assuming an IF or
I need help creating an excel formula (i'm assuming an IF or SUM IF) where certain pick list values need to be selected across columns B-N of my sheet in order to return a YES, NO, or TBD answer in co… read more
The-PC-Guy
The-PC-Guy
Bachelor\u0027s Degree
630 satisfied customers
I have a written code for C++ for the lottery. I have I
Hello, I have a written code for C++ for the lottery … read more
LogicPro
LogicPro
Engineer
Bachelor of Technology
5,867 satisfied customers
Random and independent samples of 85 recent prime time
Random and independent samples of 85recent prime time airings from each of two major networks have been considered. The first network aired a mean of 110.7commercials during prime time, with a standar… read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
This question in only for Teacher Keys! Could you please
This question in only for Sarah TeacherKeysHi, Sarah! Could you please help me find the blank models for the two keys I'm going to indicate ? Photos are attachedThe squared key says 1c arrow. If you h… read more
Sarah
Sarah
Teacher
Master\u0027s Degree
19 satisfied customers
I need help with my Marketing course but I do not see
I need help with my Marketing course but I do not see Marketing in the Category below. It is due by May 12, 2018. Only need to answer 20 questions with the appropriate answer… read more
Carter McBride
Carter McBride
LLM
1,152 satisfied customers
I have three children that complete Kumon like worksheets
I have three children that complete Kumon like worksheets daily. We live too far from a tutoring center and this is our solution. I am basically looking for a tudor to check their daily worksheets, ma… read more
Sandhya_sharma
Sandhya_sharma
Master\u0027s Degree
560 satisfied customers
Need help with American Government. I am taking this class
JA: The Tutor can help you get an A on your homework or ace your next test. Tell me more about what you need help with so we can help you best. Customer: Need help with American Government JA: Is ther… read more
judybailey61
judybailey61
Bachelors degree
196 satisfied customers
I will have Us history exam today at 2pm Los Angeles time 50
Hello I will have Us history exam today at 2pm Los Angeles time 50 multiple questions … read more
Susan Markel
Susan Markel
4th Grade Teacher
Bachelor\u0027s Degree
5 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x