- Inherits from:
- Object
- Package:
- com.apple.yellow.application
The objects created by NSAlertPanel are NSPanels (or, in user terminology, dialogs) displayed in modal sessions; they inform users of an event and offer, through buttons, a set of alternatives. The text in these dialogs is localized. The text can be formatted with variable information, using String concatenation. The methods of NSAlertPanel are of two general sorts; one group of methods creates and runs an NSPanel in a modal session for you, while the other group creates and returns an NSPanel object (you must run it in a modal session yourself). Because NSAlertPanel is a final class, you cannot subclass it.
Constant | Type | Description |
DefaultReturn |
int | The value returned when the first (default) button from the right edge of the NSAlertPanel is clicked. |
AlternateReturn |
int | The value returned when the second button from the right edge of the NSAlertPanel is clicked. |
OtherReturn |
int | The value returned when the third button from the right edge of the NSAlertPanel is clicked. |
ErrorReturn |
int | The value returned if running the NSAlertPanel resulted in an error. |
- Constructors
- NSAlertPanel
- Running an alert panel
- runAlert
- runCriticalAlert
- runInformationalAlert
- Getting an alert panel
- alertPanel
- criticalAlertPanel
- informationalAlertPanel
- releaseAlert
public NSRunAlertPanel()
public static NSPanel alertPanel(
String title,
String message,
String defaultButton,
String alternateButton,
String otherButton)
See Also: criticalAlertPanel, informationalAlertPanel
public static NSPanel criticalAlertPanel(
String title,
String message,
String defaultButton,
String alternateButton,
String otherButton)
See Also: informationalAlertPanel
public static NSPanel informationalAlertPanel(
String title,
String message,
String defaultButton,
String alternateButton,
String otherButton)
See Also: criticalAlertPanel
public static void releaseAlert(NSPanel alertPanel)
public static int runAlert(
String title,
String message,
String defaultButton,
String alternateButton,
String otherButton)
ErrorReturn
if an error occurred
running the modal panel. The buttons are laid right to left from
the lower-right corner of the NSPanel (defaultButton first).
If title is null or an empty string,
a default localized title is used ("Alert" in English).
If defaultButton is null or an empty
string, a default localized button title ("OK" in English)
is used. For the remaining buttons, this method creates them only
if their corresponding button title is non-null.See Also: runCriticalAlert, runInformationalAlert
public static int runCriticalAlert(
String title,
String message,
String defaultButton,
String alternateButton,
String otherButton)
See Also: runInformationalAlert
public static int runInformationalAlert(
String title,
String message,
String defaultButton,
String alternateButton,
String otherButton)
See Also: runCriticalAlert