// Show the layout dialog:
final PrintLayoutDialog dialog = new PrintLayoutDialog(
(BufferedImage) image, layout, frame, LOCALE.get("PrintDialogTitle")
);
// Hook up behaviors for the dialog buttons:
dialog.addCancelAction(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
dialog.dispose();
if (callback != null)
callback.done();