Centered license text.

This commit is contained in:
Doublestrike
2011-12-15 02:26:29 +00:00
parent ff4f136742
commit 03a3dafe71
2 changed files with 30 additions and 22 deletions

View File

@@ -113,7 +113,7 @@ public class ControlUtilities {
} }
}); });
this.view.getTarLicensing().addMouseListener(new MouseAdapter() { this.view.getTpnLicensing().addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (licensingExpanded) { if (licensingExpanded) {
@@ -141,24 +141,26 @@ public class ControlUtilities {
} }
private void showLicenseInfo() { private void showLicenseInfo() {
view.getTarLicensing().setText( view.getTpnLicensing().setText(
"This program is free software : you can redistribute it and/or modify " "Forge License Information"
+ "\r\n\r\n"
+ "This program is free software : you can redistribute it and/or modify "
+ "it under the terms of the GNU General Public License as published by " + "it under the terms of the GNU General Public License as published by "
+ "the Free Software Foundation, either version 3 of the License, or " + "the Free Software Foundation, either version 3 of the License, or "
+ "(at your option) any later version." + "(at your option) any later version."
+ "\r\n" + "\r\n\r\n"
+ "This program is distributed in the hope that it will be useful, " + "This program is distributed in the hope that it will be useful, "
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
+ "GNU General Public License for more details." + "GNU General Public License for more details."
+ "\r\n" + "\r\n\r\n"
+ "You should have received a copy of the GNU General Public License " + "You should have received a copy of the GNU General Public License "
+ "along with this program. If not, see <http://www.gnu.org/licenses/>." + "along with this program. If not, see <http://www.gnu.org/licenses/>."
); );
} }
private void hideLicenseInfo() { private void hideLicenseInfo() {
view.getTarLicensing().setText("Click here for license information."); view.getTpnLicensing().setText("Click here for license information.");
} }
/** /**

View File

@@ -3,8 +3,11 @@ package forge.view.home;
import java.awt.Font; import java.awt.Font;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextArea; import javax.swing.JTextPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
@@ -20,7 +23,7 @@ public class ViewUtilities extends JPanel {
private HomeTopLevel parentView; private HomeTopLevel parentView;
private ControlUtilities control; private ControlUtilities control;
private FSkin skin; private FSkin skin;
private JTextArea tarLicensing; private JTextPane tpnLicensing;
private SubButton btnDownloadSetPics, btnDownloadPics, btnDownloadQuestImages, private SubButton btnDownloadSetPics, btnDownloadPics, btnDownloadQuestImages,
btnReportBug, btnImportPictures, btnHowToPlay, btnDownloadPrices, btnReportBug, btnImportPictures, btnHowToPlay, btnDownloadPrices,
@@ -73,19 +76,22 @@ public class ViewUtilities extends JPanel {
this.add(btnStackReport, "h 30px!, w 50%!, gapleft 25%, gapbottom 2%"); this.add(btnStackReport, "h 30px!, w 50%!, gapleft 25%, gapbottom 2%");
*/ */
tarLicensing = new JTextArea(); tpnLicensing = new JTextPane();
tarLicensing.setOpaque(false); tpnLicensing.setOpaque(false);
tarLicensing.setForeground(skin.getColor("text")); tpnLicensing.setForeground(skin.getColor("text"));
tarLicensing.setFont(skin.getFont1().deriveFont(Font.PLAIN, 15)); tpnLicensing.setFont(skin.getFont1().deriveFont(Font.PLAIN, 15));
tarLicensing.setAlignmentX(SwingConstants.CENTER); tpnLicensing.setAlignmentX(SwingConstants.CENTER);
tarLicensing.setLineWrap(true); tpnLicensing.setFocusable(false);
tarLicensing.setWrapStyleWord(true); tpnLicensing.setEditable(false);
tarLicensing.setFocusable(false); tpnLicensing.setBorder(null);
tarLicensing.setEditable(false); tpnLicensing.setText("Click here for license information.");
tarLicensing.setBorder(null);
tarLicensing.setText("Click here for license information.");
this.add(tarLicensing, "w 80%!, gapleft 10%, ax center"); StyledDocument doc = tpnLicensing.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
this.add(tpnLicensing, "w 80%!, gapleft 10%, ax center");
ViewUtilities.this.control = new ControlUtilities(this); ViewUtilities.this.control = new ControlUtilities(this);
} }
@@ -131,8 +137,8 @@ public class ViewUtilities extends JPanel {
} }
/** @return JTextArea */ /** @return JTextArea */
public JTextArea getTarLicensing() { public JTextPane getTpnLicensing() {
return tarLicensing; return tpnLicensing;
} }
/** @return ControlUtilities */ /** @return ControlUtilities */