Iam opening an image into a jLabel using the get graphics/drawimage method. how can i add sliders to this label so that if an image bigger than the canvas is opened you can use the sliders to view it all??
Although since you're doing painting through getGraphics() it's all temporary - when the scrollpane repaints the JLabel (when you scroll around) the image won't be displayed any more.
You should be loading the image into an ImageIcon and setting the icon on the JLabel - then it will be a permanent change to the JLabel and will survive repaint events.
You would just add the scrollpane to the same location you are currently adding the label to. If the buffered image reference changes, you'll need to create another ImageIcon of it and re-set the new ImageIcon on the JLabel using jLabel1.setIcon(new ImageIcon(scaledBI)); However, if you're just painting to the buffered image's graphics context - through scaledBI.getGraphics() - the buffered image reference stays the same and you won't have to re-set the image icon. [ March 07, 2007: Message edited by: Nathan Pruett ]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.