code: public static void show( BufferedImage image, String title, boolean modal ) {
          JDialog f = new JDialog();
          f.add(new ImageViewer(image), BorderLayout.CENTER);
          f.setTitle(title);
          f.setIconImage(ImageCache.getInstance().getBufferedImage(ImageCache.HORTONMACHINE_FRAME_ICON));
          f.setModal(modal);
          f.pack();
          int h = image.getHeight();
          int w = image.getWidth();
          if (h > w) {
              f.setSize(new Dimension(600, 800));
          } else {
              f.setSize(new Dimension(800, 600));
          }
          f.setLocationRelativeTo(null); // Center on screen
          f.setVisible(true);
          f.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
          f.getRootPane().registerKeyboardAction(e -> {
              f.dispose();
          }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
      }
docs: Opens a JDialog with the image viewer in it.
  
  @param image the image to show.
  @param title the title of the dialog.
  @param modal if <code>true</code>, the dialog is modal.