gui: code cleanup
authorNiki Roo <niki@nikiroo.be>
Tue, 26 Mar 2019 18:52:51 +0000 (19:52 +0100)
committerNiki Roo <niki@nikiroo.be>
Tue, 26 Mar 2019 18:52:51 +0000 (19:52 +0100)
src/be/nikiroo/fanfix/reader/ui/GuiReaderBook.java

index 15d2ad4407ed487554a5586e6c2012986e5b2fb3..f0e1371eda728fa02504d5a602576f4244bedbbb 100644 (file)
@@ -154,14 +154,14 @@ class GuiReaderBook extends JPanel {
                addMouseListener(new MouseListener() {
                        @Override
                        public void mouseReleased(MouseEvent e) {
-                               if (e.isPopupTrigger()) {
+                               if (isEnabled() && e.isPopupTrigger()) {
                                        popup(e);
                                }
                        }
 
                        @Override
                        public void mousePressed(MouseEvent e) {
-                               if (e.isPopupTrigger()) {
+                               if (isEnabled() && e.isPopupTrigger()) {
                                        popup(e);
                                }
                        }
@@ -188,6 +188,7 @@ class GuiReaderBook extends JPanel {
                                        }
 
                                        lastClick = now;
+                                       e.consume();
                                }
                        }
 
@@ -206,6 +207,8 @@ class GuiReaderBook extends JPanel {
                                        listener.select((GuiReaderBook.this));
                                        listener.popupRequested(GuiReaderBook.this, e);
                                }
+
+                               e.consume();
                        }
                });
        }