I'm trying to make a constructor that has a name and a gender for a Person class (basic stuff). What I don't know how to do is to limit the options to the gender to the obvious two ones.
private String name;
private String gender;
public Person(String name, String gender){[INDENT]this.name = name;
this.gender = gender;[/INDENT]}
In Swing I can do it by using a JComboBox by supplying only the two variables to the option list. How can I do it only for text?
Edited by ch3etah, 01 June 2011 - 02:26 AM.


Sign In
Create Account

Back to top









