I have two custom text fields: RoundTextField and RoundPasswordField. They extend JTextField and JPasswordField respectively. But they both have the exact code except the RoundPasswordField has EchoChar and functionality to handle ShowPassword checkbox. I find myself writing the same code for both of them because RoundPasswordField can't extend RoundTextField because JTextField doesn't have EchoChar. Is there any workaround?
I think extending RoundPasswordField to RoundTextField and setting the EchoChar to /u000 might be a solution but it sounds wrong semantically. So is there any cleaner solution?