Article View: borland.public.jbuilder.java.swing
Article #11348Re: JScrollPane does not work !!!
From: Qiang Song
Date: Mon, 14 Jun 1999 00:00
Date: Mon, 14 Jun 1999 00:00
41 lines
1554 bytes
1554 bytes
The image I choose is very large image and even I set the size of the
canvas, still no good.
Qiang Song wrote:
> Following is a very short testing code. There is no scrollbar with
> JScrollPane ! Same thing with ScrollPane. Help is wanted and
> aprreciated!
>
> import java.awt.*;
> import java.awt.image.*;
> import javax.swing.*;
>
> public class myFrame extends JFrame {
> JScrollPane scrollPane;
> myCanvas c;
> public myFrame(){
> c = new myCanvas();
> scrollPane = new JScrollPane(c);
> this.getContentPane().add(scrollPane);
> }
>
> public static void main(String args[]){
> myFrame f = new myFrame();
> f.setSize(200, 300);
> f.setVisible(true);
> }
> }
>
> class myCanvas extends Canvas{
> Image img;
>
> public myCanvas(){
> //you may change image to your own
> img = Toolkit.getDefaultToolkit().getImage("AboutSwing.gif");
> }
>
> public void paint(Graphics g){
> g.drawImage(img, 0, 0, this);
> }
> }
Technical Details
Message-ID:
<37652CE2.3D17546E@kla-tencor.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37645300.7636ED33@kla-tencor.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,8e0dc61fd8ca804f X-Google-Attributes: gid111d45,public From: Qiang Song <qiang.song@kla-tencor.com> Subject: Re: JScrollPane does not work !!! Date: 1999/06/14 Message-ID: <37652CE2.3D17546E@kla-tencor.com> X-Deja-AN: 489487432 Content-Transfer-Encoding: 7bit References: <37645300.7636ED33@kla-tencor.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing