Issue#36 improved about dialog

This commit is contained in:
Didier Clermonté 2016-08-06 22:51:31 +02:00
parent 49d30e1195
commit 4ee42dc6c4
2 changed files with 7 additions and 14 deletions

View File

@ -29,6 +29,7 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.Locale; import java.util.Locale;
import javax.swing.Box; import javax.swing.Box;
@ -119,7 +120,8 @@ public class AboutDialog extends JDialog
{ {
resource = "/org/dclermonte/siba/gui/about_en.html"; resource = "/org/dclermonte/siba/gui/about_en.html";
} }
txtpnSimpleBackupDveloppeur.setText(SibaUtils.readResource(resource)); URL url = AboutDialog.class.getResource(resource);
txtpnSimpleBackupDveloppeur.setText(SibaUtils.readResource(resource, url));
panel.add(txtpnSimpleBackupDveloppeur); panel.add(txtpnSimpleBackupDveloppeur);
{ {
JLabel lblNewLabel = new JLabel(""); JLabel lblNewLabel = new JLabel("");

View File

@ -33,7 +33,6 @@ import java.security.NoSuchAlgorithmException;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.dclermonte.siba.gui.AboutDialog;
/** /**
* *
@ -230,21 +229,13 @@ public class SibaUtils
* @return * @return
* @throws IOException * @throws IOException
*/ */
public static String readResource(final String resource) throws IOException public static String readResource(final String resource, final URL url) throws IOException
{ {
String result; String result;
InputStream inputStream = null; InputStream inputStream = null;
try
{ result = IOUtils.toString(url, (String) null);
URL url = AboutDialog.class.getResource(resource);
inputStream = url.openStream();
result = IOUtils.toString(inputStream, (String) null);
inputStream.close();
}
finally
{
IOUtils.closeQuietly(inputStream);
}
return result; return result;
} }