/** Sets the default editors. */ protected void setDefaultEditors() { TableColumnModel model = TABLE.getColumnModel(); TableColumn tc = model.getColumn(LibraryPlaylistsTableDataLine.STARRED_IDX); tc.setCellEditor(new PlaylistItemStarEditor()); TABLE.addMouseMotionListener( new MouseMotionAdapter() { int currentCellColumn = -1; int currentCellRow = -1; @Override public void mouseMoved(MouseEvent e) { Point hit = e.getPoint(); int hitColumn = TABLE.columnAtPoint(hit); int hitRow = TABLE.rowAtPoint(hit); if (currentCellRow != hitRow || currentCellColumn != hitColumn) { if (TABLE.getCellRenderer(hitRow, hitColumn) instanceof PlaylistItemStarRenderer) { TABLE.editCellAt(hitRow, hitColumn); } currentCellColumn = hitColumn; currentCellRow = hitRow; } } }); tc = model.getColumn(LibraryPlaylistsTableDataLine.TITLE_IDX); tc.setCellEditor(new LibraryNameHolderEditor()); }
/** * Adds the mouse listeners to the wrapped <tt>JTable</tt>. * * @param listener the <tt>MouseInputListener</tt> that handles mouse events for the library */ void addMouseInputListener(final MouseInputListener listener) { TABLE.addMouseListener(listener); TABLE.addMouseMotionListener(listener); }