2016-04-19 22:34:25 +02:00
|
|
|
/*
|
2016-04-26 23:02:26 +02:00
|
|
|
* Copyright (C) 2016 Didier Clermonté <dclermonte@april.org>
|
2016-04-19 22:34:25 +02:00
|
|
|
* 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/>.
|
|
|
|
*/
|
2016-03-29 23:25:18 +02:00
|
|
|
package org.dclermonte.siba.gui;
|
|
|
|
|
|
|
|
import java.awt.BorderLayout;
|
2016-04-19 22:34:25 +02:00
|
|
|
import java.awt.Color;
|
2016-07-06 23:05:54 +02:00
|
|
|
import java.awt.Component;
|
2016-06-02 23:18:20 +02:00
|
|
|
import java.awt.Cursor;
|
2016-07-04 16:02:01 +02:00
|
|
|
import java.awt.Dimension;
|
2016-04-19 22:34:25 +02:00
|
|
|
import java.awt.Font;
|
2016-06-06 23:28:54 +02:00
|
|
|
import java.awt.Toolkit;
|
2016-04-19 22:34:25 +02:00
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import java.awt.event.ActionListener;
|
2016-07-04 16:02:01 +02:00
|
|
|
import java.io.IOException;
|
2016-07-28 23:38:52 +02:00
|
|
|
import java.util.Locale;
|
2016-03-29 23:25:18 +02:00
|
|
|
|
2016-07-06 23:05:54 +02:00
|
|
|
import javax.swing.Box;
|
|
|
|
import javax.swing.BoxLayout;
|
2016-06-06 23:28:54 +02:00
|
|
|
import javax.swing.ImageIcon;
|
2016-03-29 23:25:18 +02:00
|
|
|
import javax.swing.JButton;
|
|
|
|
import javax.swing.JDialog;
|
2016-06-06 23:28:54 +02:00
|
|
|
import javax.swing.JLabel;
|
2016-03-29 23:25:18 +02:00
|
|
|
import javax.swing.JPanel;
|
|
|
|
import javax.swing.JTextPane;
|
|
|
|
|
2016-07-28 23:38:52 +02:00
|
|
|
import org.dclermonte.siba.model.SibaUtils;
|
2016-06-21 15:05:12 +02:00
|
|
|
|
2016-05-18 23:20:29 +02:00
|
|
|
/**
|
|
|
|
*
|
2016-05-22 21:47:41 +02:00
|
|
|
* @author dclermonte
|
2016-05-18 23:20:29 +02:00
|
|
|
*
|
|
|
|
*/
|
2016-03-29 23:25:18 +02:00
|
|
|
public class AboutDialog extends JDialog
|
|
|
|
{
|
2016-05-03 17:36:45 +02:00
|
|
|
private static final long serialVersionUID = 8868109575782482455L;
|
|
|
|
|
2016-03-29 23:25:18 +02:00
|
|
|
/**
|
2016-05-19 18:40:00 +02:00
|
|
|
* This is the constructor for the dialog.
|
2016-07-04 16:02:01 +02:00
|
|
|
*
|
|
|
|
* @throws IOException
|
2016-03-29 23:25:18 +02:00
|
|
|
*/
|
2016-07-04 16:02:01 +02:00
|
|
|
public AboutDialog() throws IOException
|
2016-03-29 23:25:18 +02:00
|
|
|
{
|
2016-07-06 23:05:54 +02:00
|
|
|
|
2016-07-04 16:02:01 +02:00
|
|
|
setMinimumSize(new Dimension(600, 350));
|
|
|
|
setMaximumSize(new Dimension(600, 500));
|
2016-06-06 23:28:54 +02:00
|
|
|
setIconImage(Toolkit.getDefaultToolkit()
|
|
|
|
.getImage(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo.png")));
|
2016-06-02 23:18:20 +02:00
|
|
|
setBackground(Color.GREEN);
|
|
|
|
getContentPane().setBackground(Color.GREEN);
|
2016-03-29 23:25:18 +02:00
|
|
|
setBounds(100, 100, 450, 300);
|
|
|
|
getContentPane().setLayout(new BorderLayout());
|
|
|
|
{
|
|
|
|
JPanel buttonPane = new JPanel();
|
2016-06-02 23:18:20 +02:00
|
|
|
buttonPane.setBackground(Color.GREEN);
|
2016-03-29 23:25:18 +02:00
|
|
|
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
|
|
|
{
|
|
|
|
JButton okButton = new JButton("OK");
|
2016-07-06 23:05:54 +02:00
|
|
|
okButton.setFocusTraversalKeysEnabled(false);
|
|
|
|
okButton.setFocusPainted(false);
|
|
|
|
okButton.setBackground(new Color(0, 128, 0));
|
2016-06-02 23:18:20 +02:00
|
|
|
okButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
2016-04-19 22:34:25 +02:00
|
|
|
okButton.addActionListener(new ActionListener()
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(final ActionEvent e)
|
|
|
|
{
|
2016-03-29 23:25:18 +02:00
|
|
|
setVisible(false);
|
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
});
|
2016-07-06 23:05:54 +02:00
|
|
|
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
|
|
|
|
{
|
|
|
|
Component horizontalGlue = Box.createHorizontalGlue();
|
|
|
|
buttonPane.add(horizontalGlue);
|
|
|
|
}
|
2016-03-29 23:25:18 +02:00
|
|
|
okButton.setActionCommand("OK");
|
|
|
|
buttonPane.add(okButton);
|
|
|
|
getRootPane().setDefaultButton(okButton);
|
|
|
|
}
|
2016-07-06 23:05:54 +02:00
|
|
|
{
|
|
|
|
Component horizontalGlue = Box.createHorizontalGlue();
|
|
|
|
buttonPane.add(horizontalGlue);
|
|
|
|
}
|
2016-03-29 23:25:18 +02:00
|
|
|
}
|
|
|
|
JPanel panel = new JPanel();
|
2016-06-02 23:18:20 +02:00
|
|
|
panel.setBackground(Color.GREEN);
|
2016-03-29 23:25:18 +02:00
|
|
|
getContentPane().add(panel, BorderLayout.CENTER);
|
2016-07-04 16:02:01 +02:00
|
|
|
panel.setLayout(new BorderLayout(0, 0));
|
2016-04-19 22:34:25 +02:00
|
|
|
|
2016-03-29 23:25:18 +02:00
|
|
|
JTextPane txtpnSimpleBackupDveloppeur = new JTextPane();
|
2016-06-02 23:18:20 +02:00
|
|
|
txtpnSimpleBackupDveloppeur.setBackground(Color.GREEN);
|
2016-03-29 23:25:18 +02:00
|
|
|
txtpnSimpleBackupDveloppeur.setFont(new Font("Dialog", Font.BOLD, 14));
|
2016-07-04 16:02:01 +02:00
|
|
|
txtpnSimpleBackupDveloppeur.setContentType("text/html");
|
2016-07-28 23:38:52 +02:00
|
|
|
String resource;
|
|
|
|
String locale = Locale.getDefault().toString();
|
|
|
|
if (locale.equals("fr_FR"))
|
|
|
|
{
|
|
|
|
resource = "/org/dclermonte/siba/gui/about_fr.html";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resource = "/org/dclermonte/siba/gui/about_en.html";
|
|
|
|
}
|
|
|
|
txtpnSimpleBackupDveloppeur.setText(SibaUtils.readResource(resource));
|
2016-03-29 23:25:18 +02:00
|
|
|
panel.add(txtpnSimpleBackupDveloppeur);
|
2016-07-04 16:02:01 +02:00
|
|
|
{
|
|
|
|
JLabel lblNewLabel = new JLabel("");
|
|
|
|
lblNewLabel
|
|
|
|
.setIcon(new ImageIcon(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo_256.png")));
|
|
|
|
panel.add(lblNewLabel, BorderLayout.WEST);
|
|
|
|
}
|
2016-07-06 23:05:54 +02:00
|
|
|
|
2016-03-29 23:25:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|