Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > please help me in creating a form using Swing.

Reply
Thread Tools

please help me in creating a form using Swing.

 
 
boris
Guest
Posts: n/a
 
      08-10-2007
I am creating a form using SWING.Now in the form I have one JComboBox
of COUNTRY and other of STATE.Now I want it in such a way that when I
select a country from the COUNTRY JComboBox ,the corresponding states
automatically appears in the STATE JComboBox.Please help.
I hope I've put up my query clearly.
Still learning java!!

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      08-10-2007
boris wrote:
>I am creating a form ..


Form? Using Netbeans, are you? Does that translate
to a javax.swing.JFrame?

>..using SWING.


That is 'Swing' (no need to SHOUT). Please also put
a space, or preferably 2, after each full stop.

>..Now in the form I have one JComboBox
>of COUNTRY and other of STATE.


Normal Java nomenclature would suggest the UPPER_CASE
attribute names mean the member is final. Other attributes
(and methods) should be camelCase.

>...Now I want it in such a way that when I
>select a country from the COUNTRY JComboBox ,the corresponding states
>automatically appears in the STATE JComboBox.


The COUNTRY combo needs a Listener attached.
Either an ActionListener, or more likely an ItemListener*.
When the listener is activated, (re)populate the STATE
with a new ComboBoxModel**, representing the states.

* <http://java.sun.com/javase/6/docs/ap...t.ItemListener
)>
** <http://java.sun.com/javase/6/docs/ap....ComboBoxModel
)>

>Still learning java!!


A good group for those learning java is comp.lang.java.help.
comp.lang.java.gui specialises in GUI matters.

The JavaDocs (linked above) are invaluable for Java
development. Download them, bookmark them, or both.
The Java Tutorial has excellent 'trails' on Swing & Events.
<http://java.sun.com/docs/books/tutorial/uiswing/>
<http://java.sun.com/docs/books/tutorial/uiswing/events/index.html>

HTH

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.asp...neral/200708/1

 
Reply With Quote
 
 
 
 
boris
Guest
Posts: n/a
 
      08-10-2007

thank you very much.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please please please help this guy with his open source java app casioculture@gmail.com Java 4 05-05-2005 08:24 AM
Computer problems please please please help Nick Computer Support 0 06-04-2004 08:49 PM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM
Help please: Creating a printer friendly page from a form tommy Javascript 2 10-10-2003 08:04 PM



Advertisments