• Post Reply Bookmark Topic Watch Topic
  • New Topic

ComboBox Output confusion...  RSS feed

 
James Mousseau
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a basic program for a user to input a first and last name, and have the inputs output to a .txt file. I added a combo box with Mr., Mrs., etc, and I cant seem to get the output of the combo box working, Ive been fooling around with it for a while, and was wondering if anyone had an Idea on what I am doing wrong, and/or possibly a solution.

the output in the .txt file is this after It gets saved in there.
"javax.swing.JComboBox[,83,5,61x25,layout=javax.swing.plaf.metal.MetalComboBoxUI$MetalComboBoxLayoutManager,alignmentX=null,alignmentY=null,border=,flags=328,maximumSize=,minimumSize=,preferredSize=,isEditable=false,lightWeightPopupEnabled=true,maximumRowCount=8,selectedItemReminder=Mr. ] James Mousseau"

if the combobox is named "x", I requested the output as "p.println (x + " " + FirstName + " " + LastName);

And as you see all I wanted in the .txt was "Mr. James Mousseau"
If you need my code, I will share, or possibly share on a solution, as I am just practicing codes for college.

Thanks in advance, James Mousseau.
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the "getSelectedItem" method.
 
James Mousseau
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, tried it out, and works like a charm,
Much Appreciated.
[ May 29, 2008: Message edited by: James Mousseau ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!