List of utility methods to do BufferedImage Show
void | printImage(BufferedImage im, String title) print Image ImageIcon icon = new ImageIcon(im); JFrame frame = new JFrame(); frame.setTitle(title); frame.setSize(im.getWidth(), im.getHeight()); JLabel lbl = new JLabel(); lbl.setIcon(icon); frame.add(lbl); frame.setVisible(true); ... |
BufferedImage | printImageFromComponents(final Component _rootComponent, final int _currentColumn, final BufferedImage _bi) Print image from components. BufferedImage bi_ret = _bi; int adjC = 0 + _currentColumn * (D_ITEM.width + D_DISTANCE.width); int adjR = 0 + currentEntry * (D_ITEM.height + D_DISTANCE.height); Graphics g = bi_ret.getGraphics(); if (_rootComponent.getWidth() <= 0 || _rootComponent.getHeight() <= 0) { g.setColor(CLR_ERROR); } else { g.setColor(CLR_CORRECT); ... |
void | show(final BufferedImage image, final int width, final int height) show show(image, width, height, "");
|
void | showBufferedImage(BufferedImage I) Show buffered image. JFrame frame = new JFrame(); JLabel label = new JLabel(); label.setIcon(new ImageIcon(I)); frame.add(label); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
void | showImage(BufferedImage im) Show an image in a popup window. JFrame jf = new JFrame(); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.getContentPane().add(new JLabel(new ImageIcon(im))); jf.getContentPane().setBackground(Color.black); ; jf.pack(); jf.setVisible(true); |
JFrame | showImage(BufferedImage image, String title, boolean fitToScreen) show Image JFrame frame = new JFrame(title != null ? title : ""); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Image im = image; if (fitToScreen) { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int imageHeight = image.getHeight(); int imageWidth = image.getWidth(); if (imageHeight > screen.height || imageWidth > screen.width) { ... |
void | showImage(BufferedImage img) Creates a modal pop-up window showing an image. JLabel ic = new JLabel(new ImageIcon(img)); JScrollPane scroller = new JScrollPane(ic); JDialog popup = new JDialog(); popup.getContentPane().setLayout(new FlowLayout()); popup.getContentPane().add(scroller); popup.getContentPane().validate(); popup.setModal(true); popup.pack(); ... |
void | showImage(BufferedImage img) Show image in window showImage("", img);
|
void | showImage(final BufferedImage img, final HashMap show Image JFrame frame = new JFrame("image"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(0, 0, 640, 480); frame.setLayout(new BorderLayout()); JPanel panel = new JPanel() { @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; ... |
JFrame | showImage(String title, BufferedImage image) show Image final JFrame f = new JFrame(title); Container pane = f.getContentPane(); JButton display = new JButton(new ImageIcon(image)); display.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { f.dispose(); }); display.setMargin(new Insets(50, 50, 50, 50)); pane.add(display); f.pack(); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setVisible(true); return f; |