diff --git a/src/magic/ui/widget/cards/table/CardTablePanelA.java b/src/magic/ui/widget/cards/table/CardTablePanelA.java index 1b7345229b..6ff85a70f5 100644 --- a/src/magic/ui/widget/cards/table/CardTablePanelA.java +++ b/src/magic/ui/widget/cards/table/CardTablePanelA.java @@ -10,7 +10,6 @@ import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; -import javax.swing.table.JTableHeader; import magic.model.MagicCardDefinition; import magic.ui.FontsAndBorders; @@ -33,10 +32,6 @@ public class CardTablePanelA extends CardsTablePanel { // listener to change card image on selection table.getSelectionModel().addListSelectionListener(getTableListSelectionListener()); - // listener to sort on column header click - final JTableHeader header = table.getTableHeader(); - header.addMouseListener(new ColumnListener()); - // add table to scroll pane scrollpane.setViewportView(table); scrollpane.setBorder(FontsAndBorders.NO_BORDER); diff --git a/src/magic/ui/widget/cards/table/CardTablePanelB.java b/src/magic/ui/widget/cards/table/CardTablePanelB.java index 0fc9a54746..1a2afca77b 100644 --- a/src/magic/ui/widget/cards/table/CardTablePanelB.java +++ b/src/magic/ui/widget/cards/table/CardTablePanelB.java @@ -12,7 +12,6 @@ import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; -import javax.swing.table.JTableHeader; import magic.model.MagicCardDefinition; import magic.model.MagicRandom; import magic.ui.FontsAndBorders; @@ -32,10 +31,6 @@ public class CardTablePanelB extends CardsTablePanel // listener to change card image on selection table.getSelectionModel().addListSelectionListener(this); - // listener to sort on column header click - final JTableHeader header = table.getTableHeader(); - header.addMouseListener(new ColumnListener()); - // add table to scroll pane scrollpane.setViewportView(table); scrollpane.setBorder(FontsAndBorders.NO_BORDER); diff --git a/src/magic/ui/widget/cards/table/CardsTablePanel.java b/src/magic/ui/widget/cards/table/CardsTablePanel.java index 65a00c4306..12e616ebe0 100644 --- a/src/magic/ui/widget/cards/table/CardsTablePanel.java +++ b/src/magic/ui/widget/cards/table/CardsTablePanel.java @@ -5,6 +5,7 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.swing.event.TableModelEvent; +import javax.swing.table.JTableHeader; import javax.swing.table.TableColumnModel; import magic.data.GeneralConfig; import magic.model.MagicCardDefinition; @@ -37,6 +38,10 @@ abstract class CardsTablePanel extends TexturedPanel { if (!GeneralConfig.getInstance().isPreviewCardOnSelect()) { table.addMouseMotionListener(getRowMouseOverListener()); } + + // listener to sort on column header click + final JTableHeader header = table.getTableHeader(); + header.addMouseListener(new ColumnListener()); setLayout(migLayout); refreshLayout(); @@ -84,7 +89,7 @@ abstract class CardsTablePanel extends TexturedPanel { } } - protected class ColumnListener extends MouseAdapter { + private class ColumnListener extends MouseAdapter { @Override public void mouseClicked(final MouseEvent e) { final TableColumnModel colModel = table.getColumnModel(); diff --git a/src/magic/ui/widget/cards/table/DeckTablePanel.java b/src/magic/ui/widget/cards/table/DeckTablePanel.java index 996242b54b..8c09d4c067 100644 --- a/src/magic/ui/widget/cards/table/DeckTablePanel.java +++ b/src/magic/ui/widget/cards/table/DeckTablePanel.java @@ -10,7 +10,6 @@ import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; -import javax.swing.table.JTableHeader; import magic.model.MagicCardDefinition; import magic.model.MagicDeck; import magic.ui.FontsAndBorders; @@ -35,10 +34,6 @@ public class DeckTablePanel extends CardsTablePanel { this.listSelListener = getTableListSelectionListener(); table.getSelectionModel().addListSelectionListener(listSelListener); - // listener to sort on column header click - final JTableHeader header = table.getTableHeader(); - header.addMouseListener(new ColumnListener()); - // add table to scroll pane scrollpane.setViewportView(table); scrollpane.setBorder(FontsAndBorders.NO_BORDER);