🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.gui
Article #73

Re: JScrollPane: No ScrollBar with my JComponent

#73
From: Lieven Govaerts
Date: Mon, 02 Feb 1998 00:00
32 lines
1654 bytes
Hi Andreas,

I think the problem with the scrollbar you never see, is the way you put
the components on the display.

>    Pane = new JScrollPane();
>    Pane.setPreferredSize(new Dimension(700, 300));
>    MyViewport = Pane.getViewport();
>    JComponent bigTiger = new CMyImageIcon();
>    MyViewport.add(bigTiger);
>    getContentPane().add(Pane);

You should add the bigTiger component to the ScrollPane. Next step
is to add the ScrollPane to the ViewPort. So you'd have something like this:

  Pane = new JScrollPane();
  Pane.setPreferredSize(new Dimension(700, 300));
  MyViewport = Pane.getViewport();
  JComponent bigTiger = new CMyImageIcon();
! Pane.add(bigTiger);
! MyViewport.add(Pane);
// getContentPane().add(Pane);

No big change, but things should work now.

Regards,

Lieven.
--------------------------------------------------------------------------
Lieven Govaerts                            Ordina Technology
Software Engineer                          Meir 44a,  Antwerp, Belgium
Technical Details
Message-ID: <34D5ABB3.A9B3514B@usa.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34D1B252.52EF06D7@twi.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10c1fa,4dea4ca28f503351
X-Google-Attributes: gid10c1fa,public
X-Google-Thread: 10fd6d,4dea4ca28f503351
X-Google-Attributes: gid10fd6d,public
From: Lieven Govaerts <lgovaerts@usa.net>
Subject: Re: JScrollPane: No ScrollBar with my JComponent
Date: 1998/02/02
Message-ID: <34D5ABB3.A9B3514B@usa.net>
X-Deja-AN: 321330047
Content-Transfer-Encoding: 7bit
References: <34D1B252.52EF06D7@twi.ch>
X-Priority: 3 (Normal)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Ordina Technology
Newsgroups: comp.lang.java.gui,ch.comp