Because you've overridden itemStateChanged
in Race
, which was inherited from Gender
but failed to call super.itemStateChanged
, it is no longer been called in Gender
.
Add super.itemStateChanged(event);
to Race
's itemStateChanged
method, for example:
public void itemStateChanged(ItemEvent event) {
super.itemStateChanged(event);
Consider using JRadioButton
s, grouped through the use of a ButtonGroup
for the gender, as it's (typically) and either/or selection, maybe even a JComboBox
which will limit what the user can select
I would avoid extending directly from JFrame
as you've automatically limited any future expansion or use of the class.
Instead, consider using a JPanel
instead. This would mean you wouldn't "need" to extend from Gender
but could simply "include" within the Race
class.
I'd also encourage you to separate the model/data from the UI itself, so the UI modifies the model and responds to changes made to the model, but that's just me