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 javax.swing.event.HyperlinkEvent;
24: import javax.swing.event.HyperlinkListener;
25: import javax.swing.text.html.HTMLDocument;
26: import javax.swing.text.html.HTMLFrameHyperlinkEvent;
27:
28: import java.awt.*;
29: import java.awt.event.*;
30: import java.io.File;
31: import java.io.IOException;
32:
33: public class License extends JDialog implements ActionListener {
34:
35: private static License messageBox;
36: private JEditorPane taMessage;
37: private static final int WIDTH = 500;
38: private static final int HEIGHT = 300;
39:
40: private License(Frame frame, String title, boolean isModel) {
41: super (frame, title, isModel);
42: Container container = getContentPane();
43: JButton btnOK = new JButton("Close");
44: taMessage = new JEditorPane();
45: taMessage.setEditable(false);
46: taMessage.setEnabled(false);
47: container.add(new JScrollPane(taMessage));
48: Dimension screenSize = Toolkit.getDefaultToolkit()
49: .getScreenSize();
50: setBounds((int) (screenSize.getWidth() / 2) - (WIDTH / 2),
51: (int) (screenSize.getHeight() / 2) - (HEIGHT / 2),
52: WIDTH, HEIGHT);
53: btnOK.addActionListener(this );
54: JPanel southPanel = new JPanel(
55: new FlowLayout(FlowLayout.CENTER));
56: southPanel.add(btnOK);
57: container.add(southPanel, BorderLayout.SOUTH);
58: taMessage.setFont(new Font("Verdana", Font.BOLD, 11));
59: taMessage.setDisabledTextColor(Color.BLACK);
60: //taMessage.setBackground(Color.LIGHT_GRAY);
61: btnOK.setFont(new Font("Verdana", Font.BOLD, 12));
62: //btnOK.setBackground(new Color(0,0,100));
63: //btnOK.setForeground(Color.YELLOW);
64: }
65:
66: public static void showMessage(Frame frame, String title,
67: boolean isModel) {
68: if (messageBox == null)
69: messageBox = new License(frame, title, isModel);
70: messageBox.setMessage();
71: messageBox.setVisible(true);
72: }
73:
74: public void setMessage() {
75: taMessage
76: .setText("Copyright 2007 Madhav Pulipaka\n\nVela is free software; you can redistribute it and/or modify\n"
77: + "it under the terms of the GNU General Public License as published by\n"
78: + "the Free Software Foundation; either version 2 of the License, or\n"
79: + "(at your option) any later version.\n\n"
80: + "Vela is distributed in the hope that it will be useful,\n"
81: + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
82: + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
83: + "GNU General Public License for more details.\n\n"
84: + "You should have received a copy of the GNU General Public License\n"
85: + "along with Vela; if not, write to the Free Software\n"
86: + "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA");
87: }
88:
89: public void actionPerformed(ActionEvent arg0) {
90: setVisible(false);
91: }
92:
93: }
|