JAL-3026 JLabel for alignment properties in jalview-js
authorJim Procter <jprocter@issues.jalview.org>
Wed, 11 Jul 2018 19:39:10 +0000 (20:39 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 11 Jul 2018 19:39:10 +0000 (20:39 +0100)
src/jalview/gui/AlignFrame.java

index b18d33c..7525f47 100644 (file)
@@ -99,6 +99,7 @@ import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.seqfetcher.DbSourceProxy;
 
 import java.awt.BorderLayout;
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Rectangle;
 import java.awt.Toolkit;
@@ -137,13 +138,17 @@ import java.util.List;
 import java.util.Vector;
 
 import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JComponent;
 import javax.swing.JEditorPane;
 import javax.swing.JFileChooser;
 import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
 import javax.swing.JLayeredPane;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
+import javax.swing.JPanel;
 import javax.swing.JScrollPane;
+import javax.swing.JTextPane;
 import javax.swing.SwingUtilities;
 
 /**
@@ -3274,15 +3279,37 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   public void alignmentProperties()
   {
-    JEditorPane editPane = new JEditorPane("text/html", "");
-    editPane.setEditable(false);
+    JComponent pane;
     StringBuffer contents = new AlignmentProperties(viewport.getAlignment())
+
             .formatAsHtml();
-    editPane.setText(
-            MessageManager.formatMessage("label.html_content", new Object[]
-            { contents.toString() }));
+    String content = MessageManager.formatMessage("label.html_content",
+            new Object[]
+            { contents.toString() });
+    contents = null;
+
+    if (/** @j2sNative true || */
+    false)
+    {
+      JLabel textLabel = new JLabel();
+      textLabel.setText(content);
+      textLabel.setBackground(Color.WHITE);
+      
+      pane = new JPanel(new BorderLayout());
+      ((JPanel) pane).setOpaque(true);
+      ((JPanel) pane).add(textLabel, BorderLayout.CENTER);
+    }
+    else
+    {
+      JEditorPane editPane = new JEditorPane("text/html", "");
+      editPane.setEditable(false);
+      editPane.setText(content);
+      pane = editPane;
+    }
+
     JInternalFrame frame = new JInternalFrame();
-    frame.getContentPane().add(new JScrollPane(editPane));
+
+    frame.getContentPane().add(new JScrollPane(pane));
 
     Desktop.addInternalFrame(frame, MessageManager
             .formatMessage("label.alignment_properties", new Object[]