git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
README
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
reader
/
ui
/
GuiReaderGroup.java
diff --git
a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java
b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java
index db21c49c8c0d9414c4be0d6e3b1d4f41c043ed52..cd98fac58525e7f92b8af0cf8e3a2c09d74b6d8e 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java
+++ b/
src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java
@@
-2,6
+2,7
@@
package be.nikiroo.fanfix.reader.ui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
@@
-9,7
+10,6
@@
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
@@
-194,7
+194,8
@@
public class GuiReaderGroup extends JPanel {
}
@Override
}
@Override
- public void popupRequested(GuiReaderBook book, MouseEvent e) {
+ public void popupRequested(GuiReaderBook book,
+ Component target, int x, int y) {
}
@Override
}
@Override
@@
-287,7
+288,7
@@
public class GuiReaderGroup extends JPanel {
books.get(previousIndex).setSelected(false);
}
books.get(previousIndex).setSelected(false);
}
- if (index >= 0) {
+ if (index >= 0
&& !books.isEmpty()
) {
books.get(index).setSelected(true);
}
}
books.get(index).setSelected(true);
}
}
@@
-300,12
+301,19
@@
public class GuiReaderGroup extends JPanel {
*/
private void onKeyTyped(KeyEvent e) {
boolean consumed = false;
*/
private void onKeyTyped(KeyEvent e) {
boolean consumed = false;
- if (e.getKeyChar() == '\n') {
+ boolean action = e.getKeyChar() == '\n';
+ boolean popup = e.getKeyChar() == ' ';
+ if (action || popup) {
consumed = true;
int index = getSelectedBookIndex();
if (index >= 0) {
consumed = true;
int index = getSelectedBookIndex();
if (index >= 0) {
- books.get(index).action();
+ GuiReaderBook book = books.get(index);
+ if (action) {
+ book.action();
+ } else if (popup) {
+ book.popup(book, book.getWidth() / 2, book.getHeight() / 2);
+ }
}
}
}
}