Thread View: borland.public.jbuilder.java.swing
5 messages
5 total messages
Started by Bill D. Pirkle
Fri, 20 Aug 2004 20:50
JTabbedPane listener - detecting tab add and remove
Author: Bill D. Pirkle
Date: Fri, 20 Aug 2004 20:50
Date: Fri, 20 Aug 2004 20:50
12 lines
1167 bytes
1167 bytes
Hi all, Is there a way to listen for tab additions and removals to a JTabbedPane? I read the help and Googled but all I found was how to listen for tab selection changes. (I realize that what I'm trying to listen for isn't a standard user-generated event, and there are several ways to accomplish what I'm after. But a listener would be the cleanest, if such a thing exists.) Bill D. Pirkle
Re: JTabbedPane listener - detecting tab add and remove
Author: Tad Frysinger
Date: Fri, 27 Aug 2004 15:06
Date: Fri, 27 Aug 2004 15:06
22 lines
1964 bytes
1964 bytes
Bill D. Pirkle wrote: > Hi all, > > Is there a way to listen for tab additions and removals to a > JTabbedPane? I read the help and Googled but all I found was how to > listen for tab selection changes. > > (I realize that what I'm trying to listen for isn't a standard > user-generated event, and there are several ways to accomplish what > I'm after. But a listener would be the cleanest, if such a thing > exists.) > > Bill D. Pirkle All you can really do with the provided mechanics is add a change listener to the model. But that only fires stateChange events when the index is switched - which could happen on an add or remove, or somply switching tabs. I think you're into subclassing to add the behavior you want - I'd probably use a subclassed model to differentiate between "switching" due to adding/removing tabs, or just siwtching between them. Tad Frysinger (TeamB)
Re: JTabbedPane listener - detecting tab add and remove
Author: Bill D. Pirkle
Date: Fri, 27 Aug 2004 16:32
Date: Fri, 27 Aug 2004 16:32
13 lines
1548 bytes
1548 bytes
On Fri, 27 Aug 2004 09:06:33 -0600, Tad Frysinger <tadfrysinger@comcast.net> wrote: >All you can really do with the provided mechanics is add a change >listener to the model. But that only fires stateChange events when the >index is switched - which could happen on an add or remove, or somply >switching tabs. I think you're into subclassing to add the behavior you >want - I'd probably use a subclassed model to differentiate between >"switching" due to adding/removing tabs, or just siwtching between them. > >Tad Frysinger (TeamB) Thanks Tad!
Re: JTabbedPane listener - detecting tab add and remove
Author: John McGrath [TeamB]
Date: Mon, 06 Sep 2004 09:05
Date: Mon, 06 Sep 2004 09:05
17 lines
1437 bytes
1437 bytes
On 8/20/2004 at 4:50:59 PM, Bill D. Pirkle wrote:
> Is there a way to listen for tab additions and removals to a
> JTabbedPane? I read the help and Googled but all I found was how to
> listen for tab selection changes.
You can add a ContainerListener to the JTabbedPane. You will get a
componentAdded() event each time a tab is added.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: JTabbedPane listener - detecting tab add and remove
Author: Bill D. Pirkle
Date: Mon, 06 Sep 2004 16:20
Date: Mon, 06 Sep 2004 16:20
17 lines
1434 bytes
1434 bytes
On 6 Sep 2004 02:05:53 -0700, "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote: >On 8/20/2004 at 4:50:59 PM, Bill D. Pirkle wrote: > >> Is there a way to listen for tab additions and removals to a >> JTabbedPane? I read the help and Googled but all I found was how to >> listen for tab selection changes. > >You can add a ContainerListener to the JTabbedPane. You will get a >componentAdded() event each time a tab is added. Thanks John, that sounds perfect! I'm in the midst of some Visual FoxPro coding right now (dont' ask!), but I'll try your suggestion later this week. Bill D. Pirkle
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads