KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > taskblocks > app > AboutDialog


1 /*
2  * Copyright (C) Jakub Neubauer, 2007
3  *
4  * This file is part of TaskBlocks
5  *
6  * TaskBlocks is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * TaskBlocks 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 this program. If not, see <http://www.gnu.org/licenses/>.
18  */

19
20 package taskblocks.app;
21
22 import java.awt.Component JavaDoc;
23 import java.awt.Font JavaDoc;
24
25 import javax.swing.Box JavaDoc;
26 import javax.swing.JDialog JavaDoc;
27 import javax.swing.JLabel JavaDoc;
28 import javax.swing.JOptionPane JavaDoc;
29 import javax.swing.SwingConstants JavaDoc;
30 import javax.swing.border.EmptyBorder JavaDoc;
31
32 public class AboutDialog {
33     public static void showAbout(Component JavaDoc parent) {
34         
35         Box JavaDoc b = Box.createVerticalBox();
36         Box JavaDoc b2 = Box.createHorizontalBox();
37         JLabel JavaDoc l3 = new JLabel JavaDoc();
38         JLabel JavaDoc l1 = new JLabel JavaDoc("<html><h2>Task Blocks</h2>Version " + Version.VERSION);
39         JLabel JavaDoc l2 = new JLabel JavaDoc(
40                 "<html><br>"
41                 + "<center>Copyright \u00A9 2007 Jakub Neubauer<br>"
42                 +"&lt;http://taskblocks.googlecode.com&gt;"
43                 +"</center><br>"
44                 );
45         l3.setIcon(TaskBlocks.getImage("taskblocks.png"));
46         l1.setIconTextGap(30);
47         l1.setHorizontalTextPosition(SwingConstants.LEFT);
48         l1.setFont(l1.getFont().deriveFont(Font.PLAIN));
49         l2.setFont(l2.getFont().deriveFont(Font.PLAIN));
50         b2.add(l1);
51         b2.add(l3);
52         b.add(b2);
53         b.add(l2);
54         l3.setBorder(new EmptyBorder JavaDoc(0,0,0,20));
55         
56         l1.setAlignmentX(0f);
57         l2.setAlignmentX(0f);
58         l3.setAlignmentX(0f);
59         b2.setAlignmentX(0f);
60         
61         JOptionPane JavaDoc op = new JOptionPane JavaDoc(b);
62         JDialog JavaDoc d = op.createDialog(parent, "About");
63         d.setVisible(true);
64     }
65     
66     public static void main(String JavaDoc[] args) {
67         AboutDialog.showAbout(null);
68     }
69 }
70
Popular Tags