Add a listener inside or outside get method
- by James P.
I'm learning Swing and have composed an interface using a series of get methods to add components. Is it a good practise to add a Listener inside a get method as follows? I'd like to make things as decoupled as possible.
private JButton getConnectButton() {
if (connectButton == null) {
connectButton = new JButton();
…