summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2014-01-31 20:40:32 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2014-01-31 20:40:32 +0000
commite3a4dd9a62f83ea2716acf8a13b428270e6e9fda (patch)
tree00b1b66990f0ce1ecfcc5e1beb6487e5b4b45a52 /pdf-over-gui/src
parent8ae3a80bcfcbbfb265ef3f2ff765451361a7b15a (diff)
downloadpdf-over-e3a4dd9a62f83ea2716acf8a13b428270e6e9fda.tar.gz
pdf-over-e3a4dd9a62f83ea2716acf8a13b428270e6e9fda.tar.bz2
pdf-over-e3a4dd9a62f83ea2716acf8a13b428270e6e9fda.zip
Work around focus issues - use AWT Frame for now
Seems to Work on Windows, Linux git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@502 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index 7e0b76a8..9c649f1c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
@@ -21,14 +21,14 @@ import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Image;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -144,6 +144,7 @@ public class PositioningComposite extends StateComposite {
@Override
public void run() {
PositioningComposite.this.frame = SWT_AWT.new_Frame(PositioningComposite.this.mainArea);
+ PositioningComposite.this.frame.addKeyListener(PositioningComposite.this.keyListener);
}
});
// Workaround for Windows: Scrollbar always gets the event
@@ -152,7 +153,6 @@ public class PositioningComposite extends StateComposite {
}
});
- this.mainArea.addKeyListener(this.keyListener);
this.scrollbar.addSelectionListener(this.selectionListener);
requestFocus();
}
@@ -233,50 +233,53 @@ public class PositioningComposite extends StateComposite {
});
}
- private KeyListener keyListener = new KeyAdapter() {
+ KeyListener keyListener = new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
int newPage = PositioningComposite.this.currentPage;
int sigXOffset = 0;
int sigYOffset = 0;
- switch (e.keyCode) {
- case SWT.PAGE_DOWN:
+ switch (e.getKeyCode()) {
+ case KeyEvent.VK_PAGE_DOWN:
if (PositioningComposite.this.currentPage < PositioningComposite.this.numPages)
++newPage;
break;
- case SWT.PAGE_UP:
+ case KeyEvent.VK_PAGE_UP:
if (PositioningComposite.this.currentPage > 1)
--newPage;
break;
- case SWT.END:
+ case KeyEvent.VK_END:
newPage = PositioningComposite.this.numPages;
break;
- case SWT.HOME:
+ case KeyEvent.VK_HOME:
newPage = 1;
break;
- case SWT.CR:
- case SWT.KEYPAD_CR:
+ case KeyEvent.VK_ENTER:
setFinalPosition();
break;
- case SWT.ARROW_LEFT:
+ case KeyEvent.VK_LEFT:
+ case KeyEvent.VK_KP_LEFT:
sigXOffset -= Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET;
break;
- case SWT.ARROW_RIGHT:
+ case KeyEvent.VK_RIGHT:
+ case KeyEvent.VK_KP_RIGHT:
sigXOffset += Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET;
break;
- case SWT.ARROW_UP:
+ case KeyEvent.VK_UP:
+ case KeyEvent.VK_KP_UP:
sigYOffset -= Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET;
break;
- case SWT.ARROW_DOWN:
+ case KeyEvent.VK_DOWN:
+ case KeyEvent.VK_KP_DOWN:
sigYOffset += Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET;
break;
}