Skip to main content

Problem with TabbedPane

10 replies [Last post]
simski
Offline
Joined: 2008-06-10

Hi

I extended the container class, lets say ConvContainer conv, and added it to a tab in a tabbedpane. But indexOfComponent(conv) returns -1 and when I try to get the "component" in the selectionChanged event via getComponentAt() it returns a real container but not an object of my derived class (comp.getClass().getName() gives com.sun.lwuit.Container.

Do I missunderstand something here?

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
simski
Offline
Joined: 2008-06-10

Hi Shai

Thank you very much, that makes sense. Anyway, when you say "currently implemented as BorderLayout container", does it mean it will be changed in the future? And second, wouldn't it be a good idea to provide a standard API for this functionality then?

Best regards
simski

Shai Almog

Hi simski,
we currently have no intention of changing the implementation
although everything is possible in the long term.

I think we can add such an API in a future revision, you can post an
RFE (Request For Enhancement) into our issue tracker at: https://
lwuit.dev.java.net/servlets/ProjectIssues

You need an observer role for that which we grant automatically.

Thanks,
Shai.

On Jun 27, 2008, at 10:44 AM, lwuit-users@mobileandembedded.org wrote:

> Hi Shai
>
> Thank you very much, that makes sense. Anyway, when you say
> "currently implemented as BorderLayout container", does it mean it
> will be changed in the future? And second, wouldn't it be a good
> idea to provide a standard API for this functionality then?
>
> Best regards
> simski
> [Message sent by forum member 'simski' (simski)]
>
> http://forums.java.net/jive/thread.jspa?messageID=282910
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

simski
Offline
Joined: 2008-06-10

Yes, it works now (actually i used the wrong component method getComponentAt :-( ). By the way, how can I get the componentent at a specific tab index? i would like to do some things on them within the selectionChanged method were I only have from and to index.

To be more concrete, I would like to change the menu commands, dependent from the selected tab. My Idea was to let the component setting the menu commands when its tab is selected. Wrong approach?

Thanks
simski

Shai Almog

Hi Simski,
there is currently no standard API to accomplish this although since
the tabbed pane is currently implemented as a container in border
layout with a list in one of the sides and the content pane in the
center you can go over the components within the tabbed pane (always
2). Then in the component which isn't the list (the container) just
get the first element e.g.:

Container contentPane;
if(tabs.getComponentAt(0) instanceof Container) {
contentPane = (Container) tabs.getComponentAt(0);
} else {
contentPane = (Container) tabs.getComponentAt(1);
}

return contentPane.getComponentAt(0);

Thanks,
Shai.

> Yes, it works now (actually i used the wrong component method
> getComponentAt :-( ). By the way, how can I get the componentent at
> a specific tab index? i would like to do some things on them within
> the selectionChanged method were I only have from and to index.
>
> To be more concrete, I would like to change the menu commands,
> dependent from the selected tab. My Idea was to let the component
> setting the menu commands when its tab is selected. Wrong approach?
>
> Thanks
> simski
> [Message sent by forum member 'simski' (simski)]
>
> http://forums.java.net/jive/thread.jspa?messageID=282853
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

simski
Offline
Joined: 2008-06-10

Should be solved but isn't.

chenf
Offline
Joined: 2008-04-29

Hi simski,
TabbedPane.indexOfComponent() should work as expected now.
If it doesn't please let me know how to reproduce.

Thanks,
Chen

simski
Offline
Joined: 2008-06-10

Hi chen

Seems this problem ist not solved in the new code drop. Can you confirm?

Thanks
Simon

simski
Offline
Joined: 2008-06-10

Cool, thanks. Can you tell me approximately when the next drop will be?

btw, great job

chen

Hi,
We aim for 2-4 weeks from now.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Cool, thanks. Can you tell me approximately when the next drop will be?
>
> btw, great job
> [Message sent by forum member 'simski' (simski)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279675
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

chen

Hi,
That's a bug, will be fixed for the next drop

Thanks,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi
>
> I extended the container class, lets say ConvContainer conv, and added it to a tab in a tabbedpane. But indexOfComponent(conv) returns -1 and when I try to get the "component" in the selectionChanged event via getComponentAt() it returns a real container but not an object of my derived class (comp.getClass().getName() gives com.sun.lwuit.Container.
>
> Do I missunderstand something here?
>
> Thanks
> [Message sent by forum member 'simski' (simski)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279535
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net