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 alert(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. (Methods you override from superclasses
may have to be declared public.) 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.