Moved aboutdialog to GUIToolBox + some minors others
This commit is contained in:
parent
6932f3f54e
commit
5d83fc61c9
@ -39,6 +39,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextPane;
|
||||
|
||||
import org.dclermonte.siba.gui.utils.GUIToolBox;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -110,7 +111,7 @@ public class AboutDialog extends JDialog
|
||||
txtpnSimpleBackupDveloppeur.setBackground(Color.GREEN);
|
||||
txtpnSimpleBackupDveloppeur.setFont(new Font("Dialog", Font.BOLD, 14));
|
||||
txtpnSimpleBackupDveloppeur.setContentType("text/html");
|
||||
txtpnSimpleBackupDveloppeur.setText(AboutDialogUtils.aboutDialog());
|
||||
txtpnSimpleBackupDveloppeur.setText(GUIToolBox.aboutDialog());
|
||||
panel.add(txtpnSimpleBackupDveloppeur);
|
||||
{
|
||||
JLabel lblNewLabel = new JLabel("");
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Didier Clermonté <dclermonte@april.org>
|
||||
* Copyright (C) 2016 Christian Pierre Momon <christian.momon@devinsy.fr>
|
||||
*
|
||||
* This file is part of Siba.
|
||||
*
|
||||
* Siba is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.dclermonte.siba.gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Didier Clermonté (dclermonte@april.org)
|
||||
*
|
||||
*/
|
||||
public class AboutDialogUtils
|
||||
{
|
||||
private static ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String aboutDialog() throws IOException
|
||||
{
|
||||
String result = null;
|
||||
|
||||
String about = BUNDLE.getString("AboutDialog");
|
||||
File aboutFile = new File(AboutDialog.class.getResource("/org/dclermonte/siba/gui/" + about).getFile());
|
||||
result = FileUtils.readFileToString(aboutFile, (Charset) null);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ import com.jgoodies.forms.layout.RowSpec;
|
||||
public class BackupPanel extends JPanel
|
||||
{
|
||||
private static final long serialVersionUID = 4714383090458639282L;
|
||||
private static ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||
private JTextField sourceDirectoryField;
|
||||
private JTextField targetDirectoryField;
|
||||
|
||||
|
@ -114,9 +114,9 @@ public class CheckPanel extends JPanel
|
||||
|
||||
Component horizontalGlue = Box.createHorizontalGlue();
|
||||
panel.add(horizontalGlue);
|
||||
JButton ButtonCheck = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
|
||||
panel.add(ButtonCheck);
|
||||
ButtonCheck.addActionListener(new ActionListener()
|
||||
JButton btnCheck = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
|
||||
panel.add(btnCheck);
|
||||
btnCheck.addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e)
|
||||
@ -157,7 +157,7 @@ public class CheckPanel extends JPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
ButtonCheck.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
btnCheck.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
|
||||
Component horizontalGlue1 = Box.createHorizontalGlue();
|
||||
panel.add(horizontalGlue1);
|
||||
|
@ -143,7 +143,6 @@ public class SibaGUI
|
||||
logger.debug("Failed to set the system LookAndFeel.");
|
||||
}
|
||||
}
|
||||
/* UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel"); */
|
||||
logger.debug("Activated lookAndFeel: {} ", UIManager.getLookAndFeel().getName());
|
||||
|
||||
// Set default locale.
|
||||
|
@ -19,11 +19,18 @@
|
||||
*/
|
||||
package org.dclermonte.siba.gui.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.dclermonte.siba.gui.AboutDialog;
|
||||
|
||||
/**
|
||||
* Some utility
|
||||
*
|
||||
@ -32,6 +39,24 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public class GUIToolBox
|
||||
{
|
||||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String aboutDialog() throws IOException
|
||||
{
|
||||
String result = null;
|
||||
|
||||
String about = BUNDLE.getString("AboutDialog");
|
||||
File aboutFile = new File(AboutDialog.class.getResource("/org/dclermonte/siba/gui/" + about).getFile());
|
||||
result = FileUtils.readFileToString(aboutFile, (Charset) null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<String> availableLookAndFeels()
|
||||
{
|
||||
List<String> result;
|
||||
|
@ -196,7 +196,7 @@ public class SibaUtils
|
||||
in = new FileReader(choosenFile);
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
String line = bufferedReader.readLine();
|
||||
String fileNameToString = new String();
|
||||
String fileNameToString;
|
||||
fileNameToString = line.substring(33);
|
||||
in.close();
|
||||
if (choosenFile.isAbsolute())
|
||||
|
Loading…
x
Reference in New Issue
Block a user