From e0aee2e0eb48c09a557a61fece6c0f4fdcae110b Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 25 Apr 2017 13:59:18 +0100 Subject: [PATCH] JAL-2388 Tidies and other corrections so applet compiles --- src/jalview/appletgui/OverviewCanvas.java | 4 +--- src/jalview/appletgui/OverviewPanel.java | 17 +++++++++-------- src/jalview/gui/OverviewCanvas.java | 4 +--- src/jalview/renderer/OverviewRenderer.java | 5 +++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/jalview/appletgui/OverviewCanvas.java b/src/jalview/appletgui/OverviewCanvas.java index ede3b94..c763308 100644 --- a/src/jalview/appletgui/OverviewCanvas.java +++ b/src/jalview/appletgui/OverviewCanvas.java @@ -21,7 +21,6 @@ package jalview.appletgui; import jalview.renderer.OverviewRenderer; -import jalview.renderer.seqfeatures.FeatureColourFinder; import jalview.viewmodel.OverviewDimensions; import java.awt.Color; @@ -121,11 +120,10 @@ public class OverviewCanvas extends Panel { fr.transferSettings(transferRenderer); } - FeatureColourFinder finder = new FeatureColourFinder(fr); setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); - OverviewRenderer or = new OverviewRenderer(sr, finder, od); + OverviewRenderer or = new OverviewRenderer(sr, fr, od); miniMe = nullFrame.createImage(od.getWidth(), od.getHeight()); offscreen = nullFrame.createImage(od.getWidth(), od.getHeight()); diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index cf72daf..5cac6f5 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -28,19 +28,18 @@ import jalview.viewmodel.OverviewDimensionsWithHidden; import java.awt.BorderLayout; import java.awt.Dimension; +import java.awt.MenuItem; import java.awt.Panel; +import java.awt.PopupMenu; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; +import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; - public class OverviewPanel extends Panel implements Runnable, MouseMotionListener, MouseListener { @@ -105,7 +104,8 @@ public class OverviewPanel extends Panel implements Runnable, @Override public void mouseClicked(MouseEvent evt) { - if (SwingUtilities.isRightMouseButton(evt)) + // right button press + if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { showPopupMenu(evt); } @@ -136,7 +136,8 @@ public class OverviewPanel extends Panel implements Runnable, private void mouseAction(MouseEvent evt) { - if (SwingUtilities.isRightMouseButton(evt)) + // right button press + if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { if (!Platform.isAMac()) { @@ -208,7 +209,7 @@ public class OverviewPanel extends Panel implements Runnable, */ private void showPopupMenu(MouseEvent e) { - JPopupMenu popup = new JPopupMenu(); + PopupMenu popup = new PopupMenu(); ActionListener menuListener = new ActionListener() { @Override @@ -218,7 +219,7 @@ public class OverviewPanel extends Panel implements Runnable, toggleHiddenColumns(); } }; - JMenuItem item = new JMenuItem( + MenuItem item = new MenuItem( MessageManager.getString("label.togglehidden")); popup.add(item); item.addActionListener(menuListener); diff --git a/src/jalview/gui/OverviewCanvas.java b/src/jalview/gui/OverviewCanvas.java index 8bea818..05db6c2 100644 --- a/src/jalview/gui/OverviewCanvas.java +++ b/src/jalview/gui/OverviewCanvas.java @@ -22,7 +22,6 @@ package jalview.gui; import jalview.api.AlignViewportI; import jalview.renderer.OverviewRenderer; -import jalview.renderer.seqfeatures.FeatureColourFinder; import jalview.viewmodel.OverviewDimensions; import java.awt.Color; @@ -118,11 +117,10 @@ public class OverviewCanvas extends JComponent { fr.transferSettings(transferRenderer); } - FeatureColourFinder finder = new FeatureColourFinder(fr); setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); - OverviewRenderer or = new OverviewRenderer(sr, finder, od); + OverviewRenderer or = new OverviewRenderer(sr, fr, od); miniMe = or.draw(od.getRows(av.getAlignment()), od.getColumns(av.getAlignment().getHiddenColumns())); diff --git a/src/jalview/renderer/OverviewRenderer.java b/src/jalview/renderer/OverviewRenderer.java index 75b8198..60f80b1 100644 --- a/src/jalview/renderer/OverviewRenderer.java +++ b/src/jalview/renderer/OverviewRenderer.java @@ -26,6 +26,7 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.datamodel.SequenceI; import jalview.renderer.seqfeatures.FeatureColourFinder; +import jalview.renderer.seqfeatures.FeatureRenderer; import jalview.viewmodel.OverviewDimensions; import java.awt.Color; @@ -48,10 +49,10 @@ public class OverviewRenderer private float pixelsPerSeq; public OverviewRenderer(jalview.api.SequenceRenderer seqRenderer, - FeatureColourFinder colfinder, OverviewDimensions od) + FeatureRenderer ftRenderer, OverviewDimensions od) { sr = seqRenderer; - finder = colfinder; + finder = new FeatureColourFinder(ftRenderer); pixelsPerCol = od.getPixelsPerCol(); pixelsPerSeq = od.getPixelsPerSeq(); -- 1.7.10.2