From 1835bf6f84516b74bbd6334dda56a9f3953c5590 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 3 Nov 2022 15:00:52 +0100 Subject: misc cleanups --- .../gui/composites/PositioningComposite.java | 31 ++++++---------------- 1 file changed, 8 insertions(+), 23 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 b93c262f..85b950a6 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 @@ -107,25 +107,17 @@ public class PositioningComposite extends StateComposite { Constants.MAINBAR_ACTIVE_BACK_DARK.getBlue())); this.frame.add(this.viewer, BorderLayout.CENTER); - this.btnNewPage.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (PositioningComposite.this.currentPage > PositioningComposite.this.numPages) - showPage(PositioningComposite.this.numPages); - else - showPage(PositioningComposite.this.numPages + 1); - requestFocus(); - } + SWTUtils.addSelectionListener(btnNewPage, () -> { + if (this.currentPage > this.numPages) + showPage(this.numPages); + else + showPage(this.numPages + 1); + requestFocus(); }); - this.btnSign.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setFinalPosition(); - } - }); + SWTUtils.addSelectionListener(btnSign, this::setFinalPosition); - this.scrollbar.addSelectionListener(this.selectionListener); + SWTUtils.addSelectionListener(scrollbar, () -> { this.showPage(this.scrollbar.getSelection()); }); reloadResources(); requestFocus(); @@ -277,13 +269,6 @@ public class PositioningComposite extends StateComposite { } }; - private SelectionListener selectionListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - PositioningComposite.this.showPage(PositioningComposite.this.scrollbar.getSelection()); - } - }; - private Button btnSign; void showPage(final int page) { -- cgit v1.2.3