public void previewCreated(PreviewRequest request) { if (request.getRequester() == this) { final ImageIcon icon = new ImageIcon(request.getImage()); if (picPreview instanceof JLabel) { ((JLabel) picPreview).setIcon(icon); } if (picPreview instanceof JButton) { ((JButton) picPreview).setIcon(icon); } } }
public void previewCreated(PreviewRequest request) { if (request.getRequester() == this) { final ImageIcon icon = new ImageIcon(request.getImage()); java.awt.EventQueue.invokeLater( new Runnable() { public void run() { previewLabel.setIcon(icon); } }); } }