File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic

about array or vector and JCombobox?

 
Jhedzkie Skies
Ranch Hand
Posts: 118
  • 0
  • 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

James
Mark
Stephen
Carrey
Marcus
Vladmir
Shane

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
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic