/** * Initialises all of the components on this panel. */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) setLayout(new BorderLayout()); mTextArea.setRows(4); mTextArea.setLineWrap(true); mTextArea.setWrapStyleWord(true); // Register the handler for focus listening. This handler will // only notify the registered when the text changes from when // the focus is gained to when it is lost. mTextArea.addFocusListener(this); // Add the sub components this.add(mLabel, BorderLayout.NORTH); this.add(new JScrollPane(mTextArea), BorderLayout.CENTER); }