Look at image below and notice JRadioButtonMenuItem do not extends JRadioButton, even not JToggleButton. My guess is that they repeat code. :P Or perhaps they have a intermediary class inside these toggle component?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The thing is that Java does not support multiple inheritance, otherwise you could have considered having
JRadioButtonMenuItemextending bothJMenuItemandJRadioButton(although it is not clear if it would have been a good implementation choice).So this means that you have to choose one or the other, in this case, the choice has been made to extend
JMenuItem.Now, if you take a look, you see that
JMenuItemandJRadioButtonhave a common ancestor which isAbstractButtonwhich actually encapsulates aButtonModelwhere everything related to the current state of a button is stored (armed, selected, etc…).In the case of a
JRadioButtonMenuItemit uses aToggleButtonModeland so here you have how the same model is shared byJRadioButtonandJRadioButtonMenutItem.Regarding the view, this is all delegated into the
BasicRadioButtonMenuItemUIand especially more intoBasicMenuItemUI(which is the parent ofBasicRadioButtonMenuItemUI). Eventually it relies on the current Look-and-feel to provide the different icons, styles, borders, fonts, etc…And this is how the whole thing goes.