Java Utililty Methods BufferedImage Display

List of utility methods to do BufferedImage Display

Description

The list of methods to do BufferedImage Display are organized into topic(s).

Method

voiddisplay(final BufferedImage image)
display
final JFrame frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout());
final ImageIcon imageIcon = new ImageIcon(image);
JLabel imageLabel = new JLabel(imageIcon);
frame.getContentPane().add(new JScrollPane(imageLabel), BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1, 4));
JButton zoomInHButton = new JButton("+H");
...
voiddisplayImage(BufferedImage image)
display Image
ImageIcon icon = new ImageIcon(image);
JFrame frame = new JFrame();
frame.setLayout(new FlowLayout());
frame.setSize(200, 300);
JLabel lbl = new JLabel();
lbl.setIcon(icon);
frame.add(lbl);
frame.setVisible(true);
...
voiddisplayImage(final BufferedImage bufferedImage, final String title)
display Image
if (bufferedImage == null) {
    return;
SwingUtilities.invokeLater(new Runnable() {
    public void run() {
        final JFrame f = new JFrame("Image - " + title);
        f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        final int width = (int) (bufferedImage.getWidth() * 1.2);
...
voiddisplayImage(final String windowTitle, final BufferedImage image)
display Image
new JFrame(windowTitle) {
        final JLabel label = new JLabel("", new ImageIcon(image), 0);
        add(label);
        pack();
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
};
voiddisplayImageInWindow(BufferedImage image)
Display a BufferedImage in a very simple new Frame
if (image != null) {
    javax.swing.JFrame frame = new javax.swing.JFrame();
    javax.swing.JLabel label = new javax.swing.JLabel(new javax.swing.ImageIcon(image));
    frame.getContentPane().add(label, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
voiddisplayImageInWindow(BufferedImage image)
display Image In Window
javax.swing.JFrame frame = new javax.swing.JFrame();
javax.swing.JLabel label = new javax.swing.JLabel(new javax.swing.ImageIcon(image));
frame.getContentPane().add(label, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
voiddisplayImagePopup(BufferedImage img)
display Image Popup
JLabel label = new JLabel(new ImageIcon(img));
JOptionPane.showMessageDialog(null, label, "Word Debaser!", JOptionPane.PLAIN_MESSAGE, null);