How can i add image in ScrollPane ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Calvin_Kim
Posted On:   Tuesday, October 9, 2001 06:41 PM

i would like to make Panel with scrollbar, which display Image. When I tried with Label instead of Image, ScrollPane worked well. but, adding Image in ScrollPane, scrollbars don't appear. class ImagePanel extends Panel{ public ImagePanel(String fileName) { img = Toolkit.getDefaultToolkit().getImage(fileName); } class ProductFrame extends Frame { public ProductFrame(String fileName) { ScrollPane sPan = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); setLayout(null); add(imgPan); setBounds(100, 100, 800,600); } } Please use html tags to format code blocks.    More>>


i would like to make Panel with scrollbar, which display Image.
When I tried with Label instead of Image, ScrollPane worked well.
but, adding Image in ScrollPane, scrollbars don't appear.


			
class ImagePanel extends Panel{
public ImagePanel(String fileName) {
img = Toolkit.getDefaultToolkit().getImage(fileName);

}


class ProductFrame extends Frame {
public ProductFrame(String fileName) {

ScrollPane sPan = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);

setLayout(null);
add(imgPan);
setBounds(100, 100, 800,600);

}

}




Please use html tags to format code blocks.

   <<Less
About | Sitemap | Contact