montada gafsa
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

Code source interface tchat avec java

اذهب الى الأسفل

Code source interface tchat avec java Empty Code source interface tchat avec java

مُساهمة  mehdia الخميس 12 نوفمبر 2009 - 11:38

1. /*
2. * To change this template, choose Tools | Templates
3. * and open the template in the editor.
4. */
5.
6. /*
7. * NAjoutContact.java
8. *
9. * Created on 2009-08-09, 15:38:21
10. */
11. package Interface;
12.
13. import java.awt.event.ActionEvent;
14. import java.awt.event.ActionListener;
15. import java.awt.event.MouseListener;
16. import javax.swing.JOptionPane;
17. import util.OutilsWindow;
18.
19.
20. /**
21. *
22. * @author Francois
23. */
24. public class AjoutContact extends javax.swing.JDialog
25. {
26.
27. private int valeurRetour = 0;
28. public static final int ERREUR = -1;
29. public static final int PAS_INITIALISER = 0;
30. public static final int AUCUNE_ERREUR = 1;
31. /** Creates new form NAjoutContact */
32. public AjoutContact(java.awt.Frame parent, String title, boolean modal)
33. {
34. super(parent, title, modal);
35. initComponents();
36. OutilsWindow.centrer(this);
37. bCancel.addActionListener(new AjoutContact_bAnnuler_actionAdapter(this));
38. bAdd.setText("Ajouter");
39. bAdd.addActionListener(new AjoutContact_bAjouter_actionAdapter(this));
40. }
41.
42. /** This method is called from within the constructor to
43. * initialize the form.
44. * WARNING: Do NOT modify this code. The content of this method is
45. * always regenerated by the Form Editor.
46. */
47. @SuppressWarnings("unchecked")
48. // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
49. private void initComponents() {
50.
51. lNom = new javax.swing.JLabel();
52. tNom = new javax.swing.JTextField();
53. lPublicKey = new javax.swing.JLabel();
54. jScrollPane1 = new javax.swing.JScrollPane();
55. tCleePublic = new javax.swing.JTextArea();
56. lModulo = new javax.swing.JLabel();
57. jScrollPane2 = new javax.swing.JScrollPane();
58. tModulos = new javax.swing.JTextArea();
59. bCancel = new javax.swing.JButton();
60. bAdd = new javax.swing.JButton();
61.
62. setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
63.
64. lNom.setText("Nom");
65.
66. lPublicKey.setText("Clé️ public");
67.
68. jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
69.
70. tCleePublic.setColumns(20);
71. tCleePublic.setRows(5);
72. jScrollPane1.setViewportView(tCleePublic);
73.
74. lModulo.setText("Modulo");
75.
76. jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
77.
78. tModulos.setColumns(20);
79. tModulos.setRows(5);
80. jScrollPane2.setViewportView(tModulos);
81.
82. bCancel.setText("Annuler");
83.
84. bAdd.setText("Ajouter");
85.
86. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
87. getContentPane().setLayout(layout);
88. layout.setHorizontalGroup(
89. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
90. .addGroup(layout.createSequentialGroup()
91. .addContainerGap()
92. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93. .addGroup(layout.createSequentialGroup()
94. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
95. .addComponent(lPublicKey)
96. .addComponent(lNom)
97. .addComponent(lModulo))
98. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
99. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100. .addComponent(tNom, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
101. .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
102. .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)))
103. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
104. .addComponent(bAdd)
105. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
106. .addComponent(bCancel)))
107. .addContainerGap())
108. );
109. layout.setVerticalGroup(
110. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111. .addGroup(layout.createSequentialGroup()
112. .addContainerGap()
113. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
114. .addComponent(lNom)
115. .addComponent(tNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
116. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
117. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
118. .addComponent(lPublicKey)
119. .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
120. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
121. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122. .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
123. .addComponent(lModulo))
124. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
125. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
126. .addComponent(bCancel)
127. .addComponent(bAdd))
128. .addContainerGap())
129. );
130.
131. pack();
132. }// </editor-fold>//GEN-END:initComponents
133.
134. /**
135. * @param args the command line arguments
136. */
137. public static void main(String args[])
138. {
139. java.awt.EventQueue.invokeLater(new Runnable()
140. {
141.
142. public void run()
143. {
144. AjoutContact dialog = new AjoutContact(new javax.swing.JFrame(), "", true);
145. dialog.addWindowListener(new java.awt.event.WindowAdapter()
146. {
147.
148. public void windowClosing(java.awt.event.WindowEvent e)
149. {
150. System.exit(0);
151. }
152. });
153. dialog.setVisible(true);
154. }
155. });
156. }
157.
158. public String getCleePublic()
159. {
160. return tCleePublic.getText().trim();
161. }
162.
163. public String getCleeModulo()
164. {
165.
166. return tModulos.getText().trim();
167. }
168.
169. public String getNom()
170. {
171. return tNom.getText();
172. }
173.
174. public void addBAnnulerMouseListener(MouseListener e)
175. {
176. bCancel.addMouseListener(e);
177. }
178.
179. public void addBAjouterMouseListener(MouseListener e)
180. {
181. bAdd.addMouseListener(e);
182. }
183.
184. public AjoutContact()
185. {
186. this(null, "", false);
187. }
188.
189.
190. //Ajout d'un contact
191. protected void bAjouter_actionPerformed(ActionEvent e)
192. {
193. //validation
194. if (tNom.getText() != null && tNom.getText().compareTo("") != 0 &&
195. tCleePublic.getText() != null &&
196. tCleePublic.getText().compareTo("") != 0 && tModulos.getText() != null &&
197. tModulos.getText().compareTo("") != 0)
198. {
199. valeurRetour = 1;
200. setVisible(false);
201. }
202. else
203. {
204. JOptionPane.showMessageDialog(null, "Vous devez remplir tout les champs",
205. "Vous devez remplir tout les champs",
206. JOptionPane.ERROR_MESSAGE);
207. }
208. }
209.
210. protected void bAnnuler_actionPerformed(ActionEvent e)
211. {
212. valeurRetour = -1;
213. setVisible(false);
214. }
215.
216. public int getValeurRetour()
217. {
218. return valeurRetour;
219. }
220.
221. // Variables declaration - do not modify//GEN-BEGIN:variables
222. private javax.swing.JButton bAdd;
223. private javax.swing.JButton bCancel;
224. private javax.swing.JScrollPane jScrollPane1;
225. private javax.swing.JScrollPane jScrollPane2;
226. private javax.swing.JLabel lModulo;
227. private javax.swing.JLabel lNom;
228. private javax.swing.JLabel lPublicKey;
229. private javax.swing.JTextArea tCleePublic;
230. private javax.swing.JTextArea tModulos;
231. private javax.swing.JTextField tNom;
232. // End of variables declaration//GEN-END:variables
233. }
234. class AjoutContact_bAjouter_actionAdapter
235. implements ActionListener
236. {
237.
238. AjoutContact adaptee;
239.
240. AjoutContact_bAjouter_actionAdapter(AjoutContact adaptee)
241. {
242. this.adaptee = adaptee;
243. }
244.
245. public void actionPerformed(ActionEvent e)
246. {
247. adaptee.bAjouter_actionPerformed(e);
248. }
249. }
250.
251. class AjoutContact_bAnnuler_actionAdapter
252. implements ActionListener
253. {
254.
255. AjoutContact adaptee;
256.
257. AjoutContact_bAnnuler_actionAdapter(AjoutContact adaptee)
258. {
259. this.adaptee = adaptee;
260. }
261.
262. public void actionPerformed(ActionEvent e)
263. {
264. adaptee.bAnnuler_actionPerformed(e);
265. }
266. }
mehdia
mehdia
المدير
المدير

عدد المساهمات : 178
تاريخ التسجيل : 21/08/2009
العمر : 36

https://gafsa.ahlamontada.com

الرجوع الى أعلى الصفحة اذهب الى الأسفل

Code source interface tchat avec java Empty رد: Code source interface tchat avec java

مُساهمة  mehdia الخميس 12 نوفمبر 2009 - 11:40

je suis désolé cet page n'est pas bien saisie
mehdia
mehdia
المدير
المدير

عدد المساهمات : 178
تاريخ التسجيل : 21/08/2009
العمر : 36

https://gafsa.ahlamontada.com

الرجوع الى أعلى الصفحة اذهب الى الأسفل

الرجوع الى أعلى الصفحة


 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى