void () { myMainPanel = new JPanel(new BorderLayout()); myMainPanel.setOpaque(false); myMainPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { myEventDispatcher.getMulticaster().editingStarted(ContentEntryEditor.this); } @Override public void mouseEntered(MouseEvent e) { if (!myIsSelected) { highlight(true); } } @Override public void mouseExited(MouseEvent e) { if (!myIsSelected) { highlight(false); } } }); myEventDispatcher = EventDispatcher.create(ContentEntryEditorListener.class); setSelected(false); update(); }