KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > gui > AboutDialog


1 package zirc.gui ;
2
3 import java.awt.* ;
4 import java.awt.event.* ;
5 import javax.swing.* ;
6 import zirc.base.* ;
7 import java.util.* ;
8
9 //zIrc, irc client.
10
// Copyright (C) 2004 CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com
11
//
12
// This program is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU General Public License
14
// as published by the Free Software Foundation; either version 2
15
// of the License, or (at your option) any later version.
16
//
17
// This program is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
// GNU General Public License for more details.
21

22 /**
23  * <p>Title: AboutDialog</p>
24  * <p>Description: la fenetre a propos</p>
25  * <p>Copyright: Copyright (c) 2004</p>
26  * <p>Company: CoolBytes(Stephane Claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
27  * @version 1.0
28  */

29
30 public class AboutDialog extends JDialog
31 {
32   private Locale language ;
33   private final String JavaDoc projectURL = "https://zirc.dev.java.net/" ;
34   private Cursor hand ;
35   private Image logo ;
36   private GridLayout gridLayout1 = new GridLayout() ;
37   private GridLayout gridLayout2 = new GridLayout() ;
38   private JPanel jPanel1 = new JPanel() ;
39   private JLabel jLabel1 = new JLabel() ;
40   private JPanel jPanel2 = new JPanel() ;
41   private JTextArea jTextArea1 = new JTextArea() ;
42   private BorderLayout borderLayout1 = new BorderLayout() ;
43
44   public AboutDialog(Frame frame, boolean modal, Locale _language)
45   {
46     super(frame) ;
47     language = _language ;
48     setLanguage(language) ;
49     this.setModal(modal) ;
50     try
51     {
52       jbInit() ;
53       pack() ;
54     }
55     catch (Exception JavaDoc ex)
56     {
57       ex.printStackTrace() ;
58     }
59   }
60
61   private void jbInit() throws Exception JavaDoc
62   {
63     logo = Toolkit.getDefaultToolkit().getImage("fichiers/images/logo.png") ;
64     hand = new Cursor(Cursor.HAND_CURSOR) ;
65     this.getContentPane().setLayout(gridLayout1) ;
66     this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE) ;
67     this.setModal(true) ;
68     this.setResizable(false) ;
69     this.setTitle("A propos") ;
70     this.addWindowListener(new java.awt.event.WindowAdapter JavaDoc()
71     {
72       public void windowActivated(WindowEvent e)
73       {
74         this_windowActivated(e) ;
75       }
76     }) ;
77     ImagePanel imgPanel = new ImagePanel(logo) ;
78     gridLayout1.setRows(2) ;
79     jLabel1.setBorder(null) ;
80     jLabel1.setMinimumSize(new Dimension(389, 15)) ;
81     jLabel1.setPreferredSize(new Dimension(389, 30)) ;
82     jLabel1.setHorizontalAlignment(SwingConstants.CENTER) ;
83     jLabel1.setText("https://zirc.dev.java.net/") ;
84     jLabel1.addMouseListener(new java.awt.event.MouseAdapter JavaDoc()
85     {
86       public void mouseClicked(MouseEvent e)
87       {
88         jLabel1_mouseClicked(e) ;
89       }
90
91       public void mouseEntered(MouseEvent e)
92       {
93         jLabel1_mouseEntered(e) ;
94       }
95     }) ;
96     jPanel1.setLayout(borderLayout1) ;
97     jTextArea1.setEnabled(true) ;
98     jTextArea1.setMinimumSize(new Dimension(400, 120)) ;
99     jTextArea1.setPreferredSize(new Dimension(400, 120)) ;
100     jTextArea1.setEditable(false) ;
101     jTextArea1.setText("zIRC est un client irc développé en java uniquement. Sa licence d'utilisation " +
102                        "est GPL. Pour toute autre informations ou remarques: coolbytes@hotmail.com") ;
103     jTextArea1.setLineWrap(true) ;
104     jTextArea1.setWrapStyleWord(true) ;
105     jPanel1.setMinimumSize(new Dimension(400, 150)) ;
106     jPanel1.setPreferredSize(new Dimension(400, 150)) ;
107     this.getContentPane().add(jPanel2, null) ;
108     jPanel2.add(imgPanel, null) ;
109     this.getContentPane().add(jPanel1, null) ;
110     jPanel1.add(jLabel1, BorderLayout.NORTH) ;
111     jPanel1.add(jTextArea1, BorderLayout.CENTER) ;
112   }
113
114   //on lance le navigateur internet
115
void jLabel1_mouseClicked(MouseEvent e)
116   {
117     BrowserLauncher browser = new BrowserLauncher() ;
118     browser.launchBrowserForInternet(projectURL) ;
119   }
120
121   void jLabel1_mouseEntered(MouseEvent e)
122   {
123     this.setCursor(hand) ;
124   }
125
126   public void setLanguage(Locale lang)
127   {
128     ResourceBundle messages = ResourceBundle.getBundle("AboutDialog", lang) ;
129    this.setTitle(messages.getString("titre")) ;
130     jTextArea1.setText(messages.getString("texte")) ;
131   }
132
133   void this_windowActivated(WindowEvent e)
134   {
135
136   }
137 }
138
Popular Tags