diff options
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java | 34 | ||||
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 6 |
2 files changed, 16 insertions, 24 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 e04ad5b5..118f0b35 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 @@ -98,6 +98,17 @@ public class PositioningComposite extends StateComposite { StateComposite.anchor(mainArea).left(0).right(100).top(0).bottom(bottomBar, -5).set(); this.scrollbar = this.mainArea.getVerticalBar(); + this.frame = SWT_AWT.new_Frame(this.mainArea); + this.frame.addKeyListener(this.keyListener); + this.frame.addMouseWheelListener(this.mouseListener); + + this.viewer = new SignaturePanel(); + this.viewer.setSignaturePlaceholderBorderColor(new Color( + Constants.MAINBAR_ACTIVE_BACK_DARK.getRed(), + Constants.MAINBAR_ACTIVE_BACK_DARK.getGreen(), + Constants.MAINBAR_ACTIVE_BACK_DARK.getBlue())); + this.frame.add(this.viewer, BorderLayout.CENTER); + this.btnNewPage.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -109,12 +120,6 @@ public class PositioningComposite extends StateComposite { } }); - EventQueue.invokeLater(() -> { - getDisplay().syncExec(() -> { - this.frame = SWT_AWT.new_Frame(this.mainArea); - this.frame.addKeyListener(this.keyListener); - this.frame.addMouseWheelListener(this.mouseListener); - }); this.btnSign.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -135,20 +140,9 @@ public class PositioningComposite extends StateComposite { * document to display */ public void displayDocument(final PDDocument document) { - if (this.viewer == null) { - EventQueue.invokeLater(() -> { - this.viewer = new SignaturePanel(document); - this.viewer.setSignaturePlaceholderBorderColor(new Color( - Constants.MAINBAR_ACTIVE_BACK_DARK.getRed(), - Constants.MAINBAR_ACTIVE_BACK_DARK.getGreen(), - Constants.MAINBAR_ACTIVE_BACK_DARK.getBlue())); - this.frame.add(this.viewer, BorderLayout.CENTER); - }); - } else { - EventQueue.invokeLater(() -> { - this.viewer.setDocument(document); - }); - } + EventQueue.invokeLater(() -> { + this.viewer.setDocument(document); + }); if (document != null) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 37ef9eb5..008a2d2c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -113,12 +113,10 @@ public class SignaturePanel extends JPanel { /**
* Create a new PagePanel.
- * @param pdf the PDFFile to display
*/
- public SignaturePanel(PDDocument pdf) {
+ public SignaturePanel() {
super(new BorderLayout());
- setDocument(pdf);
- setPreferredSize(new Dimension(Constants.DEFAULT_MAINWINDOW_WIDTH, Constants.DEFAULT_MAINWINDOW_HEIGHT - Constants.MAINBAR_HEIGHT));
+ setDocument(null);
setFocusable(true);
addMouseListener(this.mouseListener);
addMouseMotionListener(this.mouseListener);
|