Ciao a tutti!!
ho realizzato un frame che visualizza un'immagine di grande dimensioni ... quindi ho utilizzato un JScrollPane per scrollarla... il problema è che lo ScrollPane sembra non funzionare..
questo è il codice del frame
Codice PHP:
public class JPGFrame extends JFrame{
JScrollPane scrollPane;
public JPGFrame() {
super();
setExtendedState(MAXIMIZED_BOTH);
JPGPanel jPGPanel = new JPGPanel();
scrollPane = new JScrollPane(jPGPanel);
add(scrollPane);
setVisible(true);
}
e questo è il codice del pannello che supporta l'immagine
Codice PHP:
public class JPGPanel extends JPanel {
BufferedImage bufferedImage;
public JPGPanel()
{
super();
try {
File file = new File("C:\\Users\\Lh\\Desktop\\Assembly_line_negozio_informatica.jpg");
bufferedImage = ImageIO.read(file);
} catch (IOException ex) {
Logger.getLogger(JPGPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void paint(Graphics g)
{
g.drawImage(bufferedImage,0,0,this);
}