@@ -0,0 +1,2215 @@
+package editor.gui;%0A%0Aimport java.awt.event.MouseEvent;%0Aimport java.awt.event.MouseListener;%0A%0Aimport javax.swing.event.ListSelectionEvent;%0Aimport javax.swing.event.ListSelectionListener;%0A%0Aimport editor.collection.CardList;%0Aimport editor.gui.display.CardTable;%0A%0A/**%0A * This class is a listener for changes to the selection in a %7B@link CardTable%7D,%0A * whether that selection be by mouse click or programmatically (e.g. due to changes%0A * in the backing list). Only one table in the program can have a selection at a time,%0A * so when one of them is clicked, all the rest have to be cleared.%0A * %0A * @author Alec Roelke%0A */%0Apublic class TableSelectionListener implements MouseListener, ListSelectionListener%0A%7B%0A    /** Main frame controlling table selection. */%0A    private final MainFrame frame;%0A    /** Table to watch. */%0A    private final CardTable table;%0A    /** Card list backing the table. */%0A    private final CardList list;%0A%0A    /**%0A     * Create a new listener that listens to the given table and updates its backing%0A     * list.%0A     * %0A     * @param f main frame controlling table selections%0A     * @param t table this listener should watch%0A     * @param l list backing the table%0A     */%0A    public TableSelectionListener(MainFrame f, CardTable t, CardList l)%0A    %7B%0A        frame = f;%0A        table = t;%0A        list = l;%0A    %7D%0A%0A    @Override%0A    public void mouseReleased(MouseEvent e)%0A    %7B%0A        if (table.rowAtPoint(e.getPoint()) %3C 0)%0A            frame.clearSelectedTable();%0A        else if (frame.getSelectedTable().map((t) -%3E t != table).orElse(true))%0A            frame.setSelectedComponents(table, list);%0A    %7D%0A%0A    @Override%0A    public void valueChanged(ListSelectionEvent e)%0A    %7B%0A        if (!e.getValueIsAdjusting())%0A        %7B%0A            if (table.getSelectedRow() %3E= 0)%0A                frame.setDisplayedCard(list.get(table.convertRowIndexToModel(table.getSelectedRow())));%0A            else%0A                frame.clearSelectedCard();%0A        %7D%0A    %7D%0A    %0A    @Override%0A    public void mouseClicked(MouseEvent e) %7B%7D%0A%0A    @Override%0A    public void mousePressed(MouseEvent e) %7B%7D%0A%0A    @Override%0A    public void mouseEntered(MouseEvent e) %7B%7D%0A%0A    @Override%0A    public void mouseExited(MouseEvent e) %7B%7D%0A%7D

Add class for table selection listening