i have done a hashmap and when i click one of the option in a combobox i want the hasmap value to appear in a textbox i prepared. how do i do that?..i am not using any database for my project. thank you in advance.
Would it be fair to guess that this "textbox" is a Swing JTextField? If it is, then you call "setText(value)" on it.
Anyway, let us know because answering questions based on guesswork is rather a waste of time. (That's why I just gave a short answer.) Then we can move the post to the correct forum -- this isn't the right forum, unless you want to tell us which "other API" you had in mind. And read our FAQ page TellTheDetails (follow that link) to see what other information you could provide.
Swing? Okay, let's move it to the Swing forum then.
And I added code tags to the post, so the code is more readable.
Also, don't use == to compare the contents of two String objects, use the String's equals() method instead.
Okay. So... what was your question again? You're iterating through a HashMap's entries, but what exactly do you want to do with them?
anne annette
Greenhorn
Joined: Apr 22, 2012
Posts: 8
posted
0
oo ok . thanks for that tip. well i put in a Jcombobox and and JtextField. so everytime i choose sumthing from the combobox i want the value to be seen in the textfield. for example, when i click switch name in the combobox, i want the textfield to show that value which is 1.3.6.1...(sorry cant remember the value) as i have put in the coding where switch name = 1.3.6.1.2.... so how should i do that sir?
It isn't clear to me which of those two steps you are having trouble with; at any rate, iterating through the map shouldn't be required, so you could delete that code.
anne annette
Greenhorn
Joined: Apr 22, 2012
Posts: 8
posted
0
get the value from the map and put it in the textfield.. its like the user selects the choise from the Jcombobox and the value from the selection will appear in the textfield. example i have a bunch of value and key : router name =1.3.6.1.2.3.4 then switch name=1.2.3.4.5.3 then switch value=1.2.3.5.2.. therefore the user just need to choose the name list from the combobox list which are switch name, router name, switch value. then when they choose for example switch name the value "1.2.3.4.5.3" should appear at the textfield.
In that thread, you were given a link to a tutorial on Swing event listeners. Have you gone through the tutorial?
luck, db
There are no new questions, but there may be new answers.
anne annette
Greenhorn
Joined: Apr 22, 2012
Posts: 8
posted
0
yes i did post in the forum and also in other several forums but i did not understand. and yes i did read it and try it out but it was not successful. sorry i did not mentioned it earlier.
anne annette wrote:... and yes i did read it and try it out but it was not successful.
And don't you think Tolls, who gave you that link, would like to know that?
anne annette
Greenhorn
Joined: Apr 22, 2012
Posts: 8
posted
0
excuse me MR.DARRYL when i said it was not successful i did not mean his posting i meant my attempt to understand the link was not successful and i did not know how to implement it and yes I WILL WRITE TO HIM BACK . i am very new to this forums and java that i am posting so i am not clear with the rules here but that does not mean you can write whatever you want and make a misunderstanding here. if you do not want to help its find. please do not create misunderstanding. thank you.
Anne, can you please BeNice and KeepItDown? Darryl is just doing his job as Bartender, informing you of one of our FAQ entries and why we encourage people to follow it. There is no need to snap back at him, especially in upper case letters.