Hi guys, I was just wondering if anyone had any suggestions on the best way to go about converting an object into a string? the object is being generated by an ActionEvent linked to a JComboBox selection. ie I have a JComboBox which holds 5 possible options (1-5). As far as I can tell (which probably isn't that far), the only way I can get the selected option is to use the getSelectedItem() method, however I need to use the outcome as an argument for another method which requires a string.
should I be using a diferent enquiry method to retreive the comboBox selection, or should I convert it once the object is out?
Since it is very possible that you'd want to do other things to the selected object, I'd leave the "getOrderInput()" method alone (i.e., have it return to selected object itself). If you need to pass a string to some method, call the "getOrderInput()" method and then convert it to a String. If you are going to use the "toString()" method, make sure you override it the appropriate class so it returns a relevant value.