From ca5507100157d1727bf62ec39988ea540bbf88ec Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 11 Jul 2018 20:39:10 +0100 Subject: [PATCH] JAL-3026 JLabel for alignment properties in jalview-js --- src/jalview/gui/AlignFrame.java | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index b18d33c..7525f47 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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[] -- 1.7.10.2