Ciao a tutti,
ho un problema con una BufferedImage. Praticamente non riesco a visualizzarla con la stessa qualità dell'effettiva immagine. Come mai?
Ecco il codice:
// Load an image public BufferedImage loadImage(String path) throws IOException{
JFrame frame = new JFrame("Image Loaded");
JFileChooser fileChooser = new JFileChooser();
fileChooser.addChoosableFileFilter(new TextFilter());
fileChooser.addChoosableFileFilter(new JavaCodeFilter());
int risposta = fileChooser.showOpenDialog(null);
if (risposta==fileChooser.APPROVE_OPTION) {
try { img=ImageIO.read(fileChooser.getSelectedFile());
Graphics imgg= img.createGraphics();
ImagePanel imgp= new ImagePanel(img);
imgp.paintComponent(imgg);
frame.add(imgp);
frame.setSize(W,H);
imgp.repaint();
frame.setVisible(true);
}
catch(IOException e)
{ } }
return img; }
Vi ringrazio.

Rispondi quotando