Article View: borland.public.jbuilder.java.swing
Article #1007Re: JTabbedPane listener - detecting tab add and remove
From: 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)
Technical Details
Message-ID:
<412f4df9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!easynet-quince!easynews.net!easynet-isham!easynet.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41266305.232819877@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,e6a16ff7bb5ebb64 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 27 Aug 2004 09:06:33 -0600 From: Tad Frysinger <tadfrysinger@comcast.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: JTabbedPane listener - detecting tab add and remove References: <41266305.232819877@newsgroups.borland.com> In-Reply-To: <41266305.232819877@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 64.58.30.72 Message-ID: <412f4df9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1093619193 64.58.30.72 (27 Aug 2004 08:06:33 -0700) Lines: 22 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!easynet-quince!easynews.net!easynet-isham!easynet.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail