From 3127930afa4866ad5e1b45e700045ad656cd2d9e Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Thu, 9 Feb 2017 22:52:25 +0100 Subject: Make it possible to copy from the release notes --- src/installer/lombok/installer/InstallerGUI.java | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/installer/lombok') diff --git a/src/installer/lombok/installer/InstallerGUI.java b/src/installer/lombok/installer/InstallerGUI.java index 7a94d595..5c0efcb4 100644 --- a/src/installer/lombok/installer/InstallerGUI.java +++ b/src/installer/lombok/installer/InstallerGUI.java @@ -64,11 +64,12 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JTextPane; import javax.swing.Scrollable; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.filechooser.FileFilter; -import javax.swing.plaf.basic.BasicHTML; -import javax.swing.text.View; +import javax.swing.text.html.HTMLDocument; import lombok.core.Version; import lombok.installer.OsUtils.OS; @@ -199,19 +200,23 @@ public class InstallerGUI { constraints.gridy++; constraints.fill = GridBagConstraints.BOTH; - JLabel notes = new JLabel(); + JTextPane notes = new JTextPane(); + notes.setContentType("text/html"); notes.setText(readChangeLog()); + notes.setEditable(false); + notes.setOpaque(false); + notes.setBorder(null); + notes.setSelectionStart(0); + notes.setSelectionEnd(0); + + Font font = UIManager.getFont("Label.font"); + String bodyRule = "body { font-family: " + font.getFamily() + "; font-size: " + font.getSize() + "pt; }"; + ((HTMLDocument)notes.getDocument()).getStyleSheet().addRule(bodyRule); JScrollPane scroller = new JScrollPane(notes); container.add(scroller, constraints); scroller.setPreferredSize(new Dimension(380, 240)); - View view = (View) notes.getClientProperty(BasicHTML.propertyKey); - view.setSize(380, 0.0f); - float w = view.getPreferredSpan(View.X_AXIS); - float h = view.getPreferredSpan(View.Y_AXIS); - notes.setSize((int) w, (int) h); - container.setPreferredSize(new Dimension(462, 415)); return container; } -- cgit