Call the static showDialog method

Listing 2 calls the static showDialog method of the JColorChooser class.

Figure 5 provides information for the showDialog method.

Figure 5. The showDialog method.
public static Color showDialog(
                      Component component,
                      String title,
                      Color initialColor)
                        throws HeadlessException
                        
Shows a modal color-chooser dialog and blocks 
until the dialog is hidden. If the user presses 
the "OK" button, then this method hides/disposes 
the dialog and returns the selected color. If 
the user presses the "Cancel" button or closes 
the dialog without pressing "OK", then this 
method hides/disposes the dialog and returns null.

Parameters:
  component - the parent Component for the dialog
  title - the String containing the dialog's title
  initialColor - the initial Color set when the 
    color-chooser is shown
Returns:
  the selected color or null if the user opted out
                        
File: aq.htm [Next] [Prev]