Hi!
I would like to zoom in & zoom out an image in JLayeredPane. Now I have a snippet for loading a background image into JLayeredPane. How could I now access ALL content images of JLayeredPane (it could contain multiple images) and zoom them in/out? Perhaps, somebody could send me a good web-link? Thanks!
private void loadBackground() {
JFileChooser fc = new JFileChooser("c:/");
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
ImageFilter filter = new ImageFilter();
fc.setFileFilter(filter);
int returnVal = fc.showDialog(this, "Load");
if (returnVal == 0) {
File selFile = fc.getSelectedFile();
String pathToFile = selFile.getPath();
try {
final ImageIcon icon = new ImageIcon(pathToFile);
JLabel bkg = new JLabel(icon);
bkg.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());
MainClass.getBackgroundPane().add(bkg, new Integer(2), 0);
} catch (Exception e) {
System.out.println(e.getMessage());
}
} else
{
System.out.println("The file is not selected.");
}
}