This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

about array or vector and JCombobox?

Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Report post to moderator
i am wondering...

how to put items from a text file into a JComboBox...

i know that JComboBoxes can display items which are in an array like JComboBox myCombo = new JComboBox(myArray);

now, i have this text file containing some sort of names like


these names are inside the text file entitled StudentNames.txt

i have this idea that this will be needing I/O but i don't know how to start it.

i need to load the names from the text file to an array i think? or might be a vector. but i really dont know how to do it. getting items from a text file..

any ideas are very much appreciated.
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
So there are really 2 parts to this question. Let's tackle reading a text file first. Have you tried anything at all yet? My google search turned up lots of info regarding reading a text file. Check some of those out and when you get stuck you can ask a specific question in the I/O and Streams forum.

As to the second part of your question, well, why don't we just wait for that one once you get the I/O portion down. Baby steps. I'm closing this thread because any future questions will belong in different forums.
    Bookmark Topic Watch Topic
  • New Topic