OSPE_AboutBoxPanel.java 2.58 KB
package osp.ui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * This class is the about box that contains information about the program.
 */
public class OSPE_AboutBoxPanel extends JDialog {
	private static final long serialVersionUID = 1L;

	/** Close button */
	private JButton closeButton = new JButton();
	/** Product name */
	private String product = "OSP Editor";
	/** Current version */
	private String version = "version 3.5 - November 2020";
	/** Copyright information */
	private String copyright = "Copyright (c)";
	/** Comments */
	private String comments = "IRAP Control Group Software";

	/**
	 * Constructs the "About" window.
	 */
	public OSPE_AboutBoxPanel() {
		JPanel panel1 = new JPanel();
		JPanel panel2 = new JPanel();
		JPanel insetsPanel1 = new JPanel();
		JPanel insetsPanel2 = new JPanel();
		JPanel insetsPanel3 = new JPanel();

		FlowLayout flowLayout = new FlowLayout();

		setTitle("About");

		panel1.setLayout(new BorderLayout());
		panel2.setLayout(new BorderLayout());

		insetsPanel2.setLayout(flowLayout);
		insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		JLabel imageLabel = new JLabel();
		imageLabel.setIcon(ImageUtils.createImageIcon("icons/logo_irap.jpg"));
		insetsPanel2.add(imageLabel, null);
		panel2.add(insetsPanel2, BorderLayout.WEST);
	

		GridLayout gridLayout = new GridLayout();
		gridLayout.setRows(4);
		gridLayout.setColumns(1);
		insetsPanel3.setLayout(gridLayout);
		insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10));
		insetsPanel3.add(new JLabel(product));
		insetsPanel3.add(new JLabel(version));
		insetsPanel3.add(new JLabel(copyright));
		insetsPanel3.add(new JLabel(comments));
		panel2.add(insetsPanel3, BorderLayout.CENTER);

		insetsPanel1.setLayout(flowLayout);
		closeButton.setText("CLOSE");
		closeButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		insetsPanel1.add(closeButton);
		panel1.add(insetsPanel1, BorderLayout.SOUTH);

		panel1.add(panel2, BorderLayout.NORTH);
		getContentPane().add(panel1);

		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setResizable(true);
		pack();
		setVisible(true);
	}
	
	public static void main(String[] args) {
		new OSPE_AboutBoxPanel();
	}
}