🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
4 messages
4 total messages Started by Magnus Thu, 05 May 2005 00:23
Preferred Event listener for jTabbedPane?
#419
Author: Magnus
Date: Thu, 05 May 2005 00:23
10 lines
1434 bytes
I have a series of tabs that are �in series� so that values entered in 
the first pane are used in a ComboBox in the second and third tabs. So 
when a user selects the second or third tab. I need to fill my ComboBox 
with possible new values from tab 1.

After some testing I found that stateChanged seems to be the Event to 
use. Am I doing right using this event or are there better (more 
appropriate) ways to deal with this?

Thanks
Re: Preferred Event listener for jTabbedPane?
#420
Author: Kevin Dean [TeamB]
Date: Thu, 05 May 2005 12:35
30 lines
2318 bytes
Magnus wrote:

> I have a series of tabs that are �in series� so that values entered
> in the first pane are used in a ComboBox in the second and third
> tabs. So when a user selects the second or third tab. I need to fill
> my ComboBox with possible new values from tab 1.
> 
> After some testing I found that stateChanged seems to be the Event to
> use. Am I doing right using this event or are there better (more
> appropriate) ways to deal with this?

That will work, but an alternative you might consider is creating a
ComboBoxModel derived class and assigning it to the JComboBox instance
you're interested in.  With a ComboBoxModel class, the combo box is
automatically updated when the underlying list is updated.  That way,
you are no longer dependent on the specific user interface you choose
to implement.

-- 
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/

NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html

Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
Re: Preferred Event listener for jTabbedPane?
#421
Author: Magnus
Date: Thu, 05 May 2005 13:12
29 lines
2340 bytes
Thanks Kevin

The values in tab1 will be stored in an external SQL-DB and (at least I 
planned to) fill my ComboBox from that table.

Can I still work with a Model?
If so, do you have any examples/tutorials that can guide me?

Kevin Dean [TeamB] wrote:
> Magnus wrote:
> 
> 
>>I have a series of tabs that are �in series� so that values entered
>>in the first pane are used in a ComboBox in the second and third
>>tabs. So when a user selects the second or third tab. I need to fill
>>my ComboBox with possible new values from tab 1.
>>
>>After some testing I found that stateChanged seems to be the Event to
>>use. Am I doing right using this event or are there better (more
>>appropriate) ways to deal with this?
> 
> 
> That will work, but an alternative you might consider is creating a
> ComboBoxModel derived class and assigning it to the JComboBox instance
> you're interested in.  With a ComboBoxModel class, the combo box is
> automatically updated when the underlying list is updated.  That way,
> you are no longer dependent on the specific user interface you choose
> to implement.
> 
Re: Preferred Event listener for jTabbedPane?
#422
Author: Kevin Dean [TeamB]
Date: Thu, 05 May 2005 17:32
32 lines
2222 bytes
Magnus wrote:

> Thanks Kevin
> 
> The values in tab1 will be stored in an external SQL-DB and (at least
> I planned to) fill my ComboBox from that table.
> 
> Can I still work with a Model?
> If so, do you have any examples/tutorials that can guide me?

If the combo box is going to be used to fill a field in another
database table, consider using dbSwing instead and setting the pickList
property to do the lookup.  That probably sounds a little confusing,
but check "Developing Database Applications" in the JBuilder online
help for instructions and numerous tutorials.

Here's a link to a sample ComboBoxModel:

http://www.sol-plus.com/customcomboboxmodel.html

-- 
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/

NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html

Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
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