You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Yunlong Zhao <Yu...@ingres.com> on 2010/08/06 20:35:32 UTC

Add a component to ScrollPane in Java

Hi All,

 

I am very new to Pivot and just starting to play with it. I have a
ScrollPane declared in the wtkx file as the following:

 

 

          <ScrollPane wtkx:id="serverTreeScrollPane"
verticalScrollBarPolicy="fill_to_capacity"
styles="{backgroundColor:'#E8E8E8'}"> 

          </ScrollPane>

 

And have the following code in Java to add a link button to the
scrollpane:

 

 

          LinkButton l2 = new LinkButton("Test");

          serverTreeScrollPane.add(l2);

 

When I run the code, nothing shows in the scrollpane. For BoxPane
(<BoxPane wtkx:id="serverTreeScrollPane" orientation="vertical">), the
button was added just fine.

 

What did I do wrong?

 

Thanks,

 

Yunlong


RE: Add a component to ScrollPane in Java

Posted by Yunlong Zhao <Yu...@ingres.com>.
That does the trick. Thanks Greg for the quick response.

 

Yunlong

 

________________________________

From: Greg Brown [mailto:gkbrown@mac.com] 
Sent: Friday, August 06, 2010 12:40 PM
To: user@pivot.apache.org
Subject: Re: Add a component to ScrollPane in Java

 

A scroll pane doesn't know what to do with arbitrary components added to
it via add(). You need to tell the scroll pane specifically what to do
with your component. For example, try calling:

 

  serverTreeScrollPane.setView(l2);

 

Greg

 

On Aug 6, 2010, at 2:35 PM, Yunlong Zhao wrote:





Hi All,

 

I am very new to Pivot and just starting to play with it. I have a
ScrollPane declared in the wtkx file as the following:

 

 

          <ScrollPane wtkx:id="serverTreeScrollPane"
verticalScrollBarPolicy="fill_to_capacity"styles="{backgroundColor:'#E8E
8E8'}">

          </ScrollPane>

 

And have the following code in Java to add a link button to the
scrollpane:

 

 

          LinkButton l2 = new LinkButton("Test");

          serverTreeScrollPane.add(l2);

 

When I run the code, nothing shows in the scrollpane. For BoxPane
(<BoxPane wtkx:id="serverTreeScrollPane" orientation="vertical">), the
button was added just fine.

 

What did I do wrong?

 

Thanks,

 

Yunlong

 


Re: Add a component to ScrollPane in Java

Posted by Greg Brown <gk...@mac.com>.
A scroll pane doesn't know what to do with arbitrary components added to it via add(). You need to tell the scroll pane specifically what to do with your component. For example, try calling:

  serverTreeScrollPane.setView(l2);

Greg

On Aug 6, 2010, at 2:35 PM, Yunlong Zhao wrote:

> Hi All,
>  
> I am very new to Pivot and just starting to play with it. I have a ScrollPane declared in the wtkx file as the following:
>  
>  
>           <ScrollPane wtkx:id="serverTreeScrollPane" verticalScrollBarPolicy="fill_to_capacity"styles="{backgroundColor:'#E8E8E8'}">
>           </ScrollPane>
>  
> And have the following code in Java to add a link button to the scrollpane:
>  
>  
>           LinkButton l2 = new LinkButton("Test");
>           serverTreeScrollPane.add(l2);
>  
> When I run the code, nothing shows in the scrollpane. For BoxPane (<BoxPane wtkx:id="serverTreeScrollPane" orientation="vertical">), the button was added just fine.
>  
> What did I do wrong?
>  
> Thanks,
>  
> Yunlong