01: /*
02: * Copyright 2007 Madhav Pulipaka
03: *
04: * This file is part of Vela.
05:
06: * Vela is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 2 of the License, or
09: * (at your option) any later version.
10: *
11: * Vela is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with Vela; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19: */
20: package vela.view;
21:
22: import javax.swing.*;
23: import java.awt.*;
24: import java.awt.event.*;
25:
26: public class About extends JDialog implements ActionListener {
27:
28: private static About messageBox;
29: private JEditorPane taMessage;
30: private static final int WIDTH = 400;
31: private static final int HEIGHT = 185;
32:
33: private About(Frame frame, String title, boolean isModel) {
34: super (frame, title, isModel);
35: Container container = getContentPane();
36: JButton btnOK = new JButton("Close");
37: taMessage = new JEditorPane();
38: taMessage.setEditable(false);
39: taMessage.setEnabled(false);
40: container.add(new JScrollPane(taMessage));
41: Dimension screenSize = Toolkit.getDefaultToolkit()
42: .getScreenSize();
43: setBounds((int) (screenSize.getWidth() / 2) - (WIDTH / 2),
44: (int) (screenSize.getHeight() / 2) - (HEIGHT / 2),
45: WIDTH, HEIGHT);
46: btnOK.addActionListener(this );
47: JPanel southPanel = new JPanel(
48: new FlowLayout(FlowLayout.CENTER));
49: southPanel.add(btnOK);
50: container.add(southPanel, BorderLayout.SOUTH);
51: taMessage.setFont(new Font("Verdana", Font.BOLD, 11));
52: taMessage.setDisabledTextColor(Color.BLACK);
53: //taMessage.setBackground(Color.LIGHT_GRAY);
54: btnOK.setFont(new Font("Verdana", Font.BOLD, 12));
55: //btnOK.setBackground(new Color(0,0,100));
56: //btnOK.setForeground(Color.YELLOW);
57: }
58:
59: public static void showMessage(Frame frame, String title,
60: boolean isModel) {
61: if (messageBox == null)
62: messageBox = new About(frame, title, isModel);
63: messageBox.setMessage();
64: messageBox.setVisible(true);
65: }
66:
67: public void setMessage() {
68: taMessage
69: .setText("Thank you for using Vela.\n\nRegards,\nMadhav Pulipaka");
70: }
71:
72: public void actionPerformed(ActionEvent arg0) {
73: setVisible(false);
74: }
75:
76: }
|