Feature: include app version in Settings screen (#247)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.sheepit.client.standalone.swing.activity;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
@@ -26,12 +27,15 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Hashtable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
@@ -119,10 +123,27 @@ public class Settings implements Activity {
|
||||
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
int currentRow = 0;
|
||||
|
||||
JLabel labelImage;
|
||||
try {
|
||||
// Include the version of the app as a watermark in the SheepIt logo.
|
||||
final BufferedImage watermark = ImageIO.read(getClass().getResource("/sheepit-logo.png"));
|
||||
|
||||
Graphics gph = watermark.getGraphics();
|
||||
gph.setFont(gph.getFont().deriveFont(12f));
|
||||
gph.drawString("v" + config.getJarVersion(), 335, 120);
|
||||
gph.dispose();
|
||||
|
||||
labelImage = new JLabel(new ImageIcon(watermark));
|
||||
}
|
||||
catch (Exception e) {
|
||||
// If something fails, we just show the SheepIt logo (without any watermark)
|
||||
ImageIcon image = new ImageIcon(getClass().getResource("/sheepit-logo.png"));
|
||||
labelImage = new JLabel(image);
|
||||
}
|
||||
|
||||
constraints.fill = GridBagConstraints.CENTER;
|
||||
|
||||
JLabel labelImage = new JLabel(image);
|
||||
constraints.gridwidth = 2;
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy = currentRow;
|
||||
|
||||
Reference in New Issue
Block a user