You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Frams <fe...@xs4all.nl> on 2011/08/01 23:06:50 UTC

TabPane in desktop application via code

Dear Pivot users,

sorry for the repost, I wasn't subscribed yet,

I'm new with pivot and I'm trying to make a window with a tabPane with 2
tabs with code, the documentation is a bit meagre.

Can anybody help me with this?

Thanks

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TabPane-in-desktop-application-via-code-tp3217080p3217080.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: TabPane in desktop application via code

Posted by Frams <fe...@xs4all.nl>.
Thank you, it works! Haven't tried the different renderers, sounds nice.
Pivot is a little more complicated than swing, or there is less
documentation, but it works nicely.

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TabPane-in-desktop-application-via-code-tp3217080p3218653.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: TabPane in desktop application via code

Posted by Chris Bartlett <cb...@gmail.com>.
The 'title' can be set with the static 'setTabData' method.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/TabPane.html#setTabData(org.apache.pivot.wtk.Component,
java.lang.Object)

In Pivot terms I think this is known as an 'attached' property.
See the section named 'Static Properties' here
http://pivot.apache.org/tutorials/bxml-primer.html

(I am not at a development PC now, so this might not be correct code)
Label tabContent = new Label("Content of tab");
tabPane.getTabs().add(tabContent);
TabPane.setTabData(tabContent, "The default renderer knows how to show
this text as the title");

The Object that is passed to setTabData as the 2nd argument can be any Object.
TabPane has a default renderer which will show Strings, but you can
set a custom one with
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/TabPane.html#setTabDataRenderer(org.apache.pivot.wtk.Button.DataRenderer)

Chris


On 2 August 2011 08:15, Frams <fe...@xs4all.nl> wrote:
> http://apache-pivot-users.399431.n3.nabble.com/file/n3217569/ApplicationView.java
> ApplicationView.java
>
> Thank you,
>
> tabPane.getTabs().add(--component--) words, however I still don't know how
> to set the tittle for it yet.
>
> Thanks a lot!
> Frams
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TabPane-in-desktop-application-via-code-tp3217080p3217569.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>

Re: TabPane in desktop application via code

Posted by Frams <fe...@xs4all.nl>.
http://apache-pivot-users.399431.n3.nabble.com/file/n3217569/ApplicationView.java
ApplicationView.java 

Thank you,

tabPane.getTabs().add(--component--) words, however I still don't know how
to set the tittle for it yet.

Thanks a lot!
Frams

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TabPane-in-desktop-application-via-code-tp3217080p3217569.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: TabPane in desktop application via code

Posted by Chris Bartlett <cb...@gmail.com>.
I don't know your code but it sounds like you might be adding the
Components to the wrong place.  (If possible, please post some sample
code to help us see what you are currently doing)

Are you just doing something like this?
TabPane tabPane = new TabPane();
tabPane.add(new Label("This won't work"));

If you want to add a Component to a TabPane, you need to get the
internal TabSequence first, and then add to it.

tabPane.getTabs().add(new Label("Content of tab 1");


On 2 August 2011 04:06, Frams <fe...@xs4all.nl> wrote:
> Dear Pivot users,
>
> sorry for the repost, I wasn't subscribed yet,
>
> I'm new with pivot and I'm trying to make a window with a tabPane with 2
> tabs with code, the documentation is a bit meagre.
>
> Can anybody help me with this?
>
> Thanks
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TabPane-in-desktop-application-via-code-tp3217080p3217080.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>

Re: TabPane in desktop application via code

Posted by Greg Brown <gk...@verizon.net>.
Have you looked at the tutorial? There is a section on tab panes:

http://pivot.apache.org/tutorials/tab-panes.html

The BXML Primer section is useful in understanding how markup translates to Java:

http://pivot.apache.org/tutorials/bxml-primer.html

G


On Aug 1, 2011, at 5:06 PM, Frams wrote:

> Dear Pivot users,
> 
> sorry for the repost, I wasn't subscribed yet,
> 
> I'm new with pivot and I'm trying to make a window with a tabPane with 2
> tabs with code, the documentation is a bit meagre.
> 
> Can anybody help me with this?
> 
> Thanks
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TabPane-in-desktop-application-via-code-tp3217080p3217080.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.