Write a simple class called Message
with a single
public method that brings up a modal dialog with a user specified
string message. The box should have a single button with the label
"OK". When the button is pressed, the box is dismissed. This class
should have a single static, public method with this signature:
public static void alert(String message, Frame parent)
Use a layout manager of your choice to give the dialog a pleasing appearance.
Revise the payroll applet from Class 6 so that an alert is displayed if the user enters a pay rate less than the minimum wage ($5.25 an hour).
To the Message
class add an
okCancel()
method similar to the last exercise with this
signature:
public static boolean okCancel(String message, Frame parent)
This method should return true
if the user presses the
OK Button and false
if they press the Cancel button.
To the extent possible, there should be no other public methods in
this class. Use a layout manager of your choice to give the
dialog a pleasing appearance.
Revise the payroll applet from Class 6 so that an alert is displayed if the user enters a pay rate less than the minimum wage ($5.25 an hour). If the user presses OK, the applet will calculate the total pay. Otherwise, it won't.
To the same Message
class add a third method that
brings up a query dialog that has a TextField
to allow
the user to enter a single line of text, then returns the line of
text. The method should have the following signature:
public static String query(String question, Frame parent)
The method should return whatever the user types in the box. To the extent possible, there should be no other public methods in this class. Use a layout manager of your choice to give the dialog a pleasing appearance.
Revise the payroll applet from Class 6 so that if the user enters a pay rate less than the minimum wage ($5.25 an hour) or an incorrect pay rate (e.g. "Five dollars and 25 cents") the applet puts up a dialog asking for a new rate.
Design a frame whose layout mimics the Firefox print dialog shown below. None of the components actually have to do anything. This is just an exercise in laying out components.
All four exercises must be handed in. You should hand in a cover sheet with your name, email address, URLs where the three applets can be found, and source code for each class. You should also provide screen shots of the applet running just in case the grader has trouble connecting to your web site.