APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.print

public Class ServiceDialog

extends JDialog
implements ActionListener
Class Inheritance
All Implemented Interfaces
java.awt.event.ActionListener, java.util.EventListener
Annotations
@SuppressWarnings:serial
Imports
java.awt.BorderLayout, .Component, .Container, .Dialog, .FlowLayout, .Frame, .GraphicsConfiguration, .GridBagLayout, .GridBagConstraints, .Insets, .Window, java.awt.event.ActionEvent, .ActionListener, .FocusEvent, .FocusListener, .ItemEvent, .ItemListener, .WindowEvent, .WindowAdapter, .KeyEvent, java.awt.print.PrinterJob, java.io.File, .IOException, java.net.URI, .URL, .URISyntaxException, .MalformedURLException, java.text.DecimalFormat, java.util.Locale, .ResourceBundle, .Vector, javax.print.*, javax.print.attribute.*, javax.print.attribute.standard.*, javax.swing.*, javax.swing.border.EmptyBorder, javax.swing.event.ChangeEvent, .ChangeListener, .PopupMenuEvent, .PopupMenuListener, javax.swing.text.NumberFormatter, sun.print.SunPageSelection, java.lang.reflect.Field, sun.awt.OSInfo

A class which implements a cross-platform print dialog.
Author
Chris Campbell

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ServiceDialog.AppearancePanel

The "Appearance" tab.

private class
private class
private class
ServiceDialog.GeneralPanel

The "General" tab.

private static class
ServiceDialog.IconRadioButton

A special widget that groups a JRadioButton with an associated icon, placed to the left of the radio button.

private class
private class
private class
private class
private class
private class
ServiceDialog.PageSetupPanel

The "Page Setup" tab.

private class
private class
private class
private class
private static class
ServiceDialog.ValidatingFileChooser

Similar in functionality to the default JFileChooser, except this chooser will pop up a "Do you want to overwrite..." dialog if the user selects a file that already exists.

Field Summary

Modifier and TypeField and Description
pack-priv static Class<?>
_keyEventClazz

Returns the mnemonic as a KeyEvent.VK constant from the resource.

public static final int
APPROVE

Approve print status (user activated "Print" or "OK").

private HashPrintRequestAttributeSet
private PrintRequestAttributeSet
private JButton
private JButton
public static final int
CANCEL

Cancel print status (user activated "Cancel");

private static final Insets
private int
private DocFlavor
private boolean
private ServiceDialog.ValidatingFileChooser
private static ResourceBundle
private static final Insets
private ServiceDialog.AppearancePanel
private ServiceDialog.GeneralPanel
private ServiceDialog.PageSetupPanel
private PrintService
private PrintService[]
private int
private static final String
private JTabbedPane
public static final int
WAITING

Waiting print status (user response pending).

Inherited from javax.swing.JDialog:
accessibleContextrootPanerootPaneCheckingEnabled

Constructor Summary

AccessConstructor and Description
public
ServiceDialog(GraphicsConfiguration gc, int x, int y, PrintService[] services, int defaultServiceIndex, DocFlavor flavor, PrintRequestAttributeSet attributes, Window window)

Constructor for the "standard" print dialog (containing all relevant tabs)

public
ServiceDialog(GraphicsConfiguration gc, int x, int y, PrintService ps, DocFlavor flavor, PrintRequestAttributeSet attributes, Window window)

Constructor for the solitary "page setup" dialog

Method Summary

Modifier and TypeMethod and Description
public void
actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

private static void
addToBG(AbstractButton button, Container cont, ButtonGroup bg)

Adds the AbstractButton to both the given ButtonGroup and Container

private static void
addToGB(Component comp, Container cont, GridBagLayout gridbag, GridBagConstraints constraints)

Sets the constraints for the GridBagLayout and adds the Component to the given Container

private static JButton
createButton(String key, ActionListener al)

Creates a new JButton and sets its text, mnemonic, and ActionListener

private static JCheckBox
createCheckBox(String key, ActionListener al)

Creates a new JCheckBox and sets its text, mnemonic, and ActionListener

private static JButton
createExitButton(String key, ActionListener al)

Creates a new JButton and sets its text, and ActionListener

private static JRadioButton
createRadioButton(String key, ActionListener al)

Creates a new JRadioButton and sets its text, mnemonic, and ActionListener

public void
dispose(int status)

Sets the current status flag for the dialog and disposes it (thus returning control of the parent frame back to the user)

public PrintRequestAttributeSet
getAttributes()

Returns an AttributeSet based on whether or not the user cancelled the dialog.

private static URL
getImageResource(final String key)

Returns URL for image resource

private static char
getMnemonic(String key)

Returns mnemonic character from resource

public static String
getMsg(String key)

Returns message string from resource

public PrintService
getPrintService()

Returns a PrintService based on whether or not the user cancelled the dialog.

public int
getStatus()

Returns the current status of the dialog (whether the user has selected the "Print" or "Cancel" button)

private static int
private void
handleEscKey(JButton btnCancel)

Performs Cancel when Esc key is pressed.

pack-priv void
initPageDialog(int x, int y, PrintService ps, DocFlavor flavor, PrintRequestAttributeSet attributes)

Initialize "page setup" dialog

pack-priv void
initPrintDialog(int x, int y, PrintService[] services, int defaultServiceIndex, DocFlavor flavor, PrintRequestAttributeSet attributes)

Initialize print dialog.

public static void
initResource()

Initialize ResourceBundle

private static String
private boolean
showFileChooser()

Displays a JFileChooser that allows the user to select the destination for "Print To File"

public static void
showNoPrintService(GraphicsConfiguration gc)

Creates a pop-up dialog for "no print service"

private void
updatePanels()

Updates each of the top level panels

Inherited from javax.swing.JDialog:
addImplcreateRootPanedialogInitgetAccessibleContextgetContentPanegetDefaultCloseOperationgetGlassPanegetGraphicsgetJMenuBargetLayeredPanegetRootPanegetTransferHandlerisDefaultLookAndFeelDecoratedisRootPaneCheckingEnabledparamStringprocessWindowEventremoverepaintsetContentPanesetDefaultCloseOperationsetDefaultLookAndFeelDecoratedsetGlassPanesetJMenuBarsetLayeredPanesetLayoutsetRootPanesetRootPaneCheckingEnabledsetTransferHandlerupdate