Siba/src/org/dclermonte/siba/gui/AboutDialog.java

120 lines
3.4 KiB
Java

/*
* 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.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextPane;
/**
*
* @author dclermonte
*
*/
public class AboutDialog extends JDialog
{
/**
*
*/
private static final long serialVersionUID = 8868109575782482455L;
/**
* This is the constructor for the dialog.
*/
public AboutDialog()
{
setIconImage(Toolkit.getDefaultToolkit()
.getImage(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo.png")));
setBackground(Color.GREEN);
getContentPane().setBackground(Color.GREEN);
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
{
JPanel buttonPane = new JPanel();
buttonPane.setBackground(Color.GREEN);
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
okButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
setVisible(false);
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
}
JPanel panel = new JPanel();
panel.setBackground(Color.GREEN);
getContentPane().add(panel, BorderLayout.CENTER);
{
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon(AboutDialog.class.getResource("/org/dclermonte/siba/gui/SibaLogo.png")));
panel.add(lblNewLabel);
}
JTextPane txtpnSimpleBackupDveloppeur = new JTextPane();
txtpnSimpleBackupDveloppeur.setBackground(Color.GREEN);
txtpnSimpleBackupDveloppeur.setFont(new Font("Dialog", Font.BOLD, 14));
txtpnSimpleBackupDveloppeur.setText(
"Simple Backup\n\nDéveloppeur Christian Pierre Momon et Didier Clermonté\n\nLicence GNU Affero General Public License 2016");
panel.add(txtpnSimpleBackupDveloppeur);
}
/**
* This method Launch the application.
*/
public static void main(final String string)
{
try
{
AboutDialog dialog = new AboutDialog();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}