🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11354

Re: JScrollPane does not work !!!

#11354
From: Joshua Starr
Date: Mon, 14 Jun 1999 00:00
54 lines
1958 bytes
I believe the default setting for the JScrollPane is for the scroll bars to
only to be shown as needed. You have not added anything to the JScrollPane,
so they will not show up. You can set explicitly with:

jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAY
S);

Hope that is helpful.


Joshua P Starr
MCI WorldCom Network/Directory Services
Voice: (719) 535-3125 -- Fax: (719) 535-6494
Email: joshua.starr@wcom.com

-------------------
Qiang Song <qiang.song@kla-tencor.com> wrote in message
news:37645300.7636ED33@kla-tencor.com...
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(){
  file://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: <7k3v3v$il019@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <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: "Joshua Starr" <joshua.starr@wcom.com>
Subject: Re: JScrollPane does not work !!!
Date: 1999/06/14
Message-ID: <7k3v3v$il019@forums.borland.com>
X-Deja-AN: 489609778
References: <37645300.7636ED33@kla-tencor.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Organization: MCI WorldCom
X-MSMail-Priority: Normal
Reply-To: "Joshua Starr" <joshua.starr@wcom.com>
Newsgroups: borland.public.jbuilder.java.swing