Fix license layout issues

This commit is contained in:
SiboVG 2022-02-10 20:18:11 +01:00
parent b94440cc10
commit 0e7c088c94
2 changed files with 17 additions and 15 deletions

View File

@ -12,19 +12,16 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JTextPane;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.JEditorPane;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import net.sf.openrocket.util.BugException;
@SuppressWarnings("serial")
public class DescriptionArea extends JScrollPane {
@ -180,5 +177,17 @@ public class DescriptionArea extends JScrollPane {
});
editorPane.scrollRectToVisible(new Rectangle(0, 0, 1, 1));
}
/**
* Set the font to use for the text pane. If null, then the default font from OR is used.
* @param font font to use
*/
public void setTextFont(Font font) {
if (editorPane == null) return;
editorPane.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, true);
if (font != null) {
editorPane.setFont(font);
}
}
}

View File

@ -1,21 +1,13 @@
package net.sf.openrocket.gui.dialogs;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.components.DescriptionArea;
@ -39,7 +31,7 @@ public class LicenseDialog extends JDialog {
// OpenRocket logo
panel.add(new JLabel(Icons.loadImageIcon("pix/icon/icon-about.png", "OpenRocket")), "top");
panel.add(new StyledLabel("Software Licenses", 10), "ax 50%, wrap para");
panel.add(new StyledLabel("Software Licenses", 10), "ax 50%, pushx, wrap para");
final String jarUrl = "jar:" + getClass().getProtectionDomain().getCodeSource().getLocation().toString();
final String copyrightYear = BuildProperties.getCopyrightYear();
@ -146,8 +138,9 @@ public class LicenseDialog extends JDialog {
/*****************************************************************************************************************************/
DescriptionArea info = new DescriptionArea(20);
info.setTextFont(null);
info.setText(orLicense + componentsLicense + fontLicense + commonmarkLicense);
panel.add(info, "newline, width 600lp, height 150lp, grow, spanx, wrap para");
panel.add(info, "newline, width 700lp, height 250lp, pushy, grow, spanx, wrap para");
//Close button
JButton close = new SelectColorButton(trans.get("dlg.but.close"));
@ -157,7 +150,7 @@ public class LicenseDialog extends JDialog {
LicenseDialog.this.dispose();
}
});
panel.add(close, "right");
panel.add(close, "spanx, right");
this.add(panel);
this.setTitle("OpenRocket license");