Questo il frammento di codice interessato:
Ogni volta che seleziono un'immagine, viene lanciata una NullPointerException a questa riga: image = new ImageIcon (getClass().getResource (string));, come se l'indirizzo non fosse corretto... qualche idea? o_Ocodice:JFileChooser fileChooser = new JFileChooser(); int result = fileChooser.showOpenDialog (Zoom.this); if (result == JFileChooser.APPROVE_OPTION) { String string = fileChooser.getSelectedFile().getPath(); if (string != null) { image = new ImageIcon (getClass().getResource (string)); setPreferredSize (new Dimension (image.getIconWidth(), image.getIconHeight())); repaint(); } }

Rispondi quotando