Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This should be done using BlueJ..thanks! The Friendy Window You are going to implement a simple friendly,it not exactly proactive, Gul application. Your application will

This should be done using BlueJ..thanks! image text in transcribed
image text in transcribed
The Friendy Window You are going to implement a simple friendly,it not exactly proactive, Gul application. Your application will display two buttons, Say Hir and "Say Bye. Each pops up an alert dialog saying "Hil and Goodbyel" respectively, as illustrated on pages 3 and 4 of this document You should do this in 5 steps (Be sure and compile and test your code at the end of each step) 1. Get a baskc JTrame worknsg tyve and run this and make sure it works before you move on to step 2 in the Code 13.1 example on p. 465). Note you should name your class FriendlyApp, and the window tiele etc should display that instead of "ImageViewer. Comple 2. Create the two buttons and add them to the JTrane, (see Code 13.14 example). Two important notes L You don't want your JButtons to be added to toolbar like their exmple,_you want to add them to your ContentPane. i. Youll notice you can only see whichever button you added last on the sreen, that's because we didn't set a layout manager, so the default a Bordertayout whch ony allows one item in the center . Specify that you want a two-high and one-across Gridlayout, using this code contentPane setlayout (new Gridiayout(2,1)) Now you should be able to see both your buttons, one on top of the other. .Associate the buttons with actions (methods on your same class) that create dialog boxes. Use the Sh edition Figure 11.4 example (which is attached on the next page) of adding ActionListeners using anonymous classes, which invoke methods on your class named .aynand sanre ( respectively. After you get this to con pie and run you should test at least one of these in step S. (You will need to add empty temporary definitions for the sayHip and saybye) methods to make the code comple) S. Then in sayRA0) and sayBye Goodbyel", Now when you click on the two buttons you should get the right message for each. Note: You may want to look at the documentation for 3OptionPane. There are four arguments in the shovHessageDialog give as the empty string "" . 0ptionPane. nrORMATION-MESSAGE is a good value for the fourth angiment. 5 edition Figure 11.4 for 84. The similar material in the 6 edition is 13.8.2 See also class slides () create dialog boxes using the Code 13.9example. sayR&D should display a dialog box that says "Hil and sayBye) should display a dialog box that says version that our book uses: the second argument is the window's message, which you want to be "6 and "Goodbyel", and the third argument is the window title, which you can

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

5. Develop a self-management module for a training program.

Answered: 1 week ago