I am working with GUIs on my java homework and I have to specify what other is within a JCheckBox. I have everything else finished except for this minor requirement. I'm not quite sure how to go about this, I've looked in my book and tried researching it online
Requirement:
A series of check boxes where the supervisor can choose which sports events their residents are most interested in (basketball, hockey, swimming, football, soccer, tennis, wrestling, other). Next to the check box that says "other" should be a text box so the supervisor can specify what "other" means.
If you need any clarification let me know I'm new to posting here.
Your code will look like :
JCheckBox chk_other = new JCheckBox("Other");
JTextField txt_other = new JTextField();
txt_other.setVisible(false);
chk_other.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
txt_other.setVisible(true);
}
});