diff --git a/src/uk/co/majenko/audiobookrecorder/OpenBookPanel.java b/src/uk/co/majenko/audiobookrecorder/OpenBookPanel.java index 5e5047e..8bcc007 100644 --- a/src/uk/co/majenko/audiobookrecorder/OpenBookPanel.java +++ b/src/uk/co/majenko/audiobookrecorder/OpenBookPanel.java @@ -100,11 +100,33 @@ public class OpenBookPanel extends JPanel { table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setRowHeight(80); table.getTableHeader().setUI(null); + + table.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + if (e.getClickCount() == 2 && table.getSelectedRow() != -1) { + Component c = (Component)OpenBookPanel.this; + while ((c != null) && (!(c instanceof JOptionPane))) { + c = c.getParent(); + } + if (c == null) { + System.err.println("Could not get option pane!"); + } else { + JOptionPane op = (JOptionPane)c; + op.setValue(JOptionPane.OK_OPTION); + } + } + } + }); + + + + scroll.setViewportView(table); } catch (Exception e) { e.printStackTrace(); } + } public File getSelectedFile() {