![alicciardone01](/avatars/14046.jpg)
alicciardone01
22.08.2020 •
Computers and Technology
For this lab, you will do some work on a GUI program. Most of the work is related to actions, buttons, menus, and toolbars.
When you turn in your work for this lab, you should also turn in an executable jar file of your program, in addition to all the files from your Eclipse project. See the last section on this page for information about how to create executable jar files.
To begin the lab, create a new project in Eclipse and copy-and-paste both directories – guidemo and resources -- from the code directory in this linke :
The guidemo directory is a package that contains the Java code of the program. The resources directory has several sub-directories that contain image and sound resources used by the program. You will be working only on the code in the guidemo package.
The code directory also contains an executable jar file of the completed program, GuiDemoComplete.jar. You can run this jar file to see how the program should look when it's done. In the incomplete source code that you will be working on, the main class is in GuiDemo.java, and you can execute that file to see what the program does so far.
Make a Menu
The program has a toolbar at the bottom of the window. The buttons in this toolbar have icons. If you click one of the icons, you can then use the mouse to "stamp" copies of the icon onto the picture. (Note that a short sound is played when you stamp.) If you click the button "DEL", you can use the mouse to erase icon images from the picture.
The toolbar is made by adding Actions to a JToolBar object. This is done in the class IconSupport, which contains a list of actions and a createToolbar method to create a toolbar from the actions.
Write a method createMenu() in the IconSupport class to create and return a menu with the same functionality as the toolbar. That is, all the Actions from the actions arraylist should be added to the menu, just as they were added to the toolbar. (Remember that a menu is represented by an object of type JMenu, which can be created, for example, with: JMenu stamper = new JMenu("Stamper");)
Once you have a method to create the menu, find the place in the constructor of the GuiDemo class where the menu bar is created. Use the method to create a menu, and add that menu to the menu bar. Test to make sure that it is working.
Solved
Show answers
More tips
- F Family and Home How to Sew Curtain Tapes: Best Tips from Professionals...
- A Animals and plants How to Grow Lime from a Seed: Simple Tips and Interesting Facts...
- C Computers and Internet How to Create a Folder on Your iPhone?...
- G Goods and services How to sew a ribbon: Tips for beginners...
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Computers and Technology
- C Computers and Technology A reservation process allows customers to reserve a flight, hotel room, and rental car as part of a travel itinerary. Which configuration displays a check box to allow...
- C Computers and Technology Formally prove that n^2 + n + 1 is in O(n^2). Solution: Let T(n) = n^2 + n + 1. Let f(n) = n^2. Choose c = 3, and N = 1. Then, we know T(n) is in O(n^2) if we can...
- C Computers and Technology Which of the following is an example of a trade journal? A. Sports Illustrated B. Sports Business Weekly C. Tik Tok D. The New York Times...
- H History In what ways did American colonists develop a unified sense of identity before the American Revolution?...
- M Mathematics The distance of two cities are 6 miles but in the map are 12 inches apart...
- M Mathematics ppl wass up amd chii out wit da consequnes lol...
- M Mathematics Edward deposited $9,000 into a savings account 3 years ago. The simple interest rate is 5%. How much money did Edward earn in interest? Please help im behind in math...
- B Biology What is bob ross plus barney equal?...
- M Mathematics The number b is rational. Which statement about is true? b is rational 4 b is irrational 4 b can be rational or irrational, depending on the 4. value of b....
- M Mathematics CAN SOMEONE HELP ME HOW U DO THIS...
Ответ:
D
Step-by-step explanation: