Forums Register Login

how to show hashmap value in a textbox

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
yes it is a jtext field

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
There are two steps:

(1) Get the value from the map.

(2) Put it into the text field.

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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
anne annette, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/61703-how-show-hashmap-value-textbox.html

In that thread, you were given a link to a tutorial on Swing event listeners. Have you gone through the tutorial?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
> ...i meant my attempt to understand the link was not successful...

that's how it reads to me.
you need to explain what you tried, and how it wasn't successful.
+Pie Number of slices to send: Send
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.
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2519 times.
Similar Threads
How to bind to an object inside HashMap.
autocompleter value of hashmap is not getting printed
Copy-to-clipboard
saving the details in when i click next and previous buttons
combo and text box
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:36:21.