Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m worked in dotnet for last 3 years .I am new to java platform.
i m using dropdownlist . i want to know how to display value in textbox when i select a value in dropdown list ..(like SelectedIndex option in dotnet)
Posted

1 solution

You are using a JComboList?

check the reference: javax.swing.JComboBox[^]

There is a function getSelectedIndex() which returns an integer value. You sure know what to do with that.

Or - and that's the better method - you use the getSelecetedItem() which hands back any kind of Object. Background is that you can put Objects in the Combobox. For displaying a correct String in the Combobox the Object needs to implement the function public String toString().

decide what you need - pushing a String into the JTextbox should not make Problems (otherwise -> JAVA Swing GUI Tutorial @ oracle.com[^] )
 
Share this answer
 
Comments
RaviRanjanKr 31-Dec-11 11:28am    
My 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900