1 package zirc.gui ; 2 3 import java.awt.* ; 4 import java.awt.event.* ; 5 import javax.swing.* ; 6 7 import zirc.base.* ; 8 9 22 29 30 31 41 42 public class FontColorFrame extends JDialog 43 { 44 private AbstractChatFrame chatFrm ; 45 GridLayout gridLayout1 = new GridLayout() ; 46 JButton jButton1 = new JButton() ; 47 JButton jButton_Gris = new JButton() ; 48 JButton jButton_Rose = new JButton() ; 49 JButton jButton_BleuL = new JButton() ; 50 JButton jButton_CyanL = new JButton() ; 51 JButton jButton_Cyan = new JButton() ; 52 JButton jButton_VertL = new JButton() ; 53 JButton jButton_Jaune = new JButton() ; 54 JButton jButton_Pourpre = new JButton() ; 55 JButton jButton_Brun = new JButton() ; 56 JButton jButton_RougeL = new JButton() ; 57 JButton jButton_Vert = new JButton() ; 58 JButton jButton_Bleu = new JButton() ; 59 JButton jButton_Noir = new JButton() ; 60 JButton jButton_Blanc = new JButton() ; 61 JButton jButton_Orange = new JButton() ; 62 JButton jButton_GrisL = new JButton() ; 63 private IRCconnexion ircChan ; 64 public FontColorFrame(Frame owner, IRCconnexion IRCchan) 65 { 66 super(owner) ; 67 68 ircChan = IRCchan ; 69 70 try 71 { 72 jbInit() ; 73 } 74 catch (Exception e) 75 { 76 e.printStackTrace() ; 77 } 78 } 79 80 private void jbInit() throws Exception 81 { 82 this.setTitle("") ; 83 jButton_Blanc.setBorder(BorderFactory.createLoweredBevelBorder()) ; 84 jButton_Blanc.setText("") ; 85 gridLayout1.setColumns(8) ; 86 gridLayout1.setRows(2) ; 87 this.setResizable(false) ; 88 this.getContentPane().setLayout(gridLayout1) ; 89 jButton_Gris.setBackground(Color.gray) ; 90 jButton_Gris.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 91 jButton_Gris.setBorder(BorderFactory.createLoweredBevelBorder()) ; 92 jButton_Gris.setBorderPainted(false) ; 93 jButton_Gris.setFocusPainted(false) ; 94 jButton_Gris.setText("14") ; 95 jButton_Gris.addActionListener(new java.awt.event.ActionListener () 96 { 97 public void actionPerformed(ActionEvent e) 98 { 99 jButton_Gris_actionPerformed(e) ; 100 } 101 }) ; 102 jButton_Rose.setBackground(Color.pink) ; 103 jButton_Rose.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 104 jButton_Rose.setBorder(BorderFactory.createLoweredBevelBorder()) ; 105 jButton_Rose.setBorderPainted(false) ; 106 jButton_Rose.setFocusPainted(false) ; 107 jButton_Rose.setText("13") ; 108 jButton_Rose.addActionListener(new java.awt.event.ActionListener () 109 { 110 public void actionPerformed(ActionEvent e) 111 { 112 jButton_Rose_actionPerformed(e) ; 113 } 114 }) ; 115 jButton_BleuL.setBackground(new Color(0, 158, 255)) ; 116 jButton_BleuL.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 117 jButton_BleuL.setBorder(BorderFactory.createLoweredBevelBorder()) ; 118 jButton_BleuL.setBorderPainted(false) ; 119 jButton_BleuL.setFocusPainted(false) ; 120 jButton_BleuL.setText("12") ; 121 jButton_BleuL.addActionListener(new java.awt.event.ActionListener () 122 { 123 public void actionPerformed(ActionEvent e) 124 { 125 jButton_BleuL_actionPerformed(e) ; 126 } 127 }) ; 128 jButton_CyanL.setBackground(new Color(177, 255, 255)) ; 129 jButton_CyanL.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 130 jButton_CyanL.setBorder(BorderFactory.createLoweredBevelBorder()) ; 131 jButton_CyanL.setBorderPainted(false) ; 132 jButton_CyanL.setFocusPainted(false) ; 133 jButton_CyanL.setText("10") ; 134 jButton_CyanL.addActionListener(new java.awt.event.ActionListener () 135 { 136 public void actionPerformed(ActionEvent e) 137 { 138 jButton_CyanL_actionPerformed(e) ; 139 } 140 }) ; 141 jButton_Cyan.setBackground(Color.cyan) ; 142 jButton_Cyan.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 143 jButton_Cyan.setBorder(BorderFactory.createLoweredBevelBorder()) ; 144 jButton_Cyan.setBorderPainted(false) ; 145 jButton_Cyan.setFocusPainted(false) ; 146 jButton_Cyan.setText("11") ; 147 jButton_Cyan.addActionListener(new java.awt.event.ActionListener () 148 { 149 public void actionPerformed(ActionEvent e) 150 { 151 jButton_Cyan_actionPerformed(e) ; 152 } 153 }) ; 154 jButton_VertL.setBackground(new Color(184, 255, 177)) ; 155 jButton_VertL.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 156 jButton_VertL.setBorder(BorderFactory.createLoweredBevelBorder()) ; 157 jButton_VertL.setBorderPainted(false) ; 158 jButton_VertL.setFocusPainted(false) ; 159 jButton_VertL.setText("9") ; 160 jButton_VertL.addActionListener(new java.awt.event.ActionListener () 161 { 162 public void actionPerformed(ActionEvent e) 163 { 164 jButton_VertL_actionPerformed(e) ; 165 } 166 }) ; 167 jButton_Jaune.setBackground(Color.yellow) ; 168 jButton_Jaune.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 169 jButton_Jaune.setBorder(BorderFactory.createLoweredBevelBorder()) ; 170 jButton_Jaune.setBorderPainted(false) ; 171 jButton_Jaune.setFocusPainted(false) ; 172 jButton_Jaune.setText("8") ; 173 jButton_Jaune.addActionListener(new java.awt.event.ActionListener () 174 { 175 public void actionPerformed(ActionEvent e) 176 { 177 jButton_Jaune_actionPerformed(e) ; 178 } 179 }) ; 180 jButton_Pourpre.setBackground(new Color(255, 0, 92)) ; 181 jButton_Pourpre.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 182 jButton_Pourpre.setBorder(BorderFactory.createLoweredBevelBorder()) ; 183 jButton_Pourpre.setBorderPainted(false) ; 184 jButton_Pourpre.setFocusPainted(false) ; 185 jButton_Pourpre.setText("6") ; 186 jButton_Pourpre.addActionListener(new java.awt.event.ActionListener () 187 { 188 public void actionPerformed(ActionEvent e) 189 { 190 jButton_Pourpre_actionPerformed(e) ; 191 } 192 }) ; 193 jButton_Brun.setBackground(new Color(151, 98, 39)) ; 194 jButton_Brun.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 195 jButton_Brun.setBorder(BorderFactory.createLoweredBevelBorder()) ; 196 jButton_Brun.setBorderPainted(false) ; 197 jButton_Brun.setFocusPainted(false) ; 198 jButton_Brun.setText("5") ; 199 jButton_Brun.addActionListener(new java.awt.event.ActionListener () 200 { 201 public void actionPerformed(ActionEvent e) 202 { 203 jButton_Brun_actionPerformed(e) ; 204 } 205 }) ; 206 jButton_RougeL.setBackground(Color.red) ; 207 jButton_RougeL.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 208 jButton_RougeL.setBorder(BorderFactory.createLoweredBevelBorder()) ; 209 jButton_RougeL.setBorderPainted(false) ; 210 jButton_RougeL.setFocusPainted(false) ; 211 jButton_RougeL.setText("4") ; 212 jButton_RougeL.addActionListener(new java.awt.event.ActionListener () 213 { 214 public void actionPerformed(ActionEvent e) 215 { 216 jButton_RougeL_actionPerformed(e) ; 217 } 218 }) ; 219 jButton_Vert.setBackground(Color.green) ; 220 jButton_Vert.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 221 jButton_Vert.setBorder(BorderFactory.createLoweredBevelBorder()) ; 222 jButton_Vert.setBorderPainted(false) ; 223 jButton_Vert.setFocusPainted(false) ; 224 jButton_Vert.setText("3") ; 225 jButton_Vert.addActionListener(new java.awt.event.ActionListener () 226 { 227 public void actionPerformed(ActionEvent e) 228 { 229 jButton_Vert_actionPerformed(e) ; 230 } 231 }) ; 232 jButton_Bleu.setBackground(Color.blue) ; 233 jButton_Bleu.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 234 jButton_Bleu.setBorder(BorderFactory.createLoweredBevelBorder()) ; 235 jButton_Bleu.setBorderPainted(false) ; 236 jButton_Bleu.setFocusPainted(false) ; 237 jButton_Bleu.setText("2") ; 238 jButton_Bleu.addActionListener(new java.awt.event.ActionListener () 239 { 240 public void actionPerformed(ActionEvent e) 241 { 242 jButton_Bleu_actionPerformed(e) ; 243 } 244 }) ; 245 jButton_Noir.setBackground(Color.black) ; 246 jButton_Noir.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 247 jButton_Noir.setBorder(BorderFactory.createLoweredBevelBorder()) ; 248 jButton_Noir.setBorderPainted(false) ; 249 jButton_Noir.setFocusPainted(false) ; 250 jButton_Noir.setText("1") ; 251 jButton_Noir.addActionListener(new java.awt.event.ActionListener () 252 { 253 public void actionPerformed(ActionEvent e) 254 { 255 jButton_Noir_actionPerformed(e) ; 256 } 257 }) ; 258 jButton_Blanc.setBackground(Color.white) ; 259 jButton_Blanc.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 260 jButton_Blanc.setBorder(BorderFactory.createLoweredBevelBorder()) ; 261 jButton_Blanc.setBorderPainted(false) ; 262 jButton_Blanc.setFocusPainted(false) ; 263 jButton_Blanc.setText("0") ; 264 jButton_Blanc.addActionListener(new java.awt.event.ActionListener () 265 { 266 public void actionPerformed(ActionEvent e) 267 { 268 jButton_Blanc_actionPerformed(e) ; 269 } 270 }) ; 271 jButton_GrisL.setBackground(Color.lightGray) ; 272 jButton_GrisL.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 273 jButton_GrisL.setBorder(BorderFactory.createLoweredBevelBorder()) ; 274 jButton_GrisL.setBorderPainted(false) ; 275 jButton_GrisL.setFocusPainted(false) ; 276 jButton_GrisL.setText("15") ; 277 jButton_GrisL.addActionListener(new java.awt.event.ActionListener () 278 { 279 public void actionPerformed(ActionEvent e) 280 { 281 jButton_GrisL_actionPerformed(e) ; 282 } 283 }) ; 284 jButton_Orange.setBackground(Color.orange) ; 285 jButton_Orange.setFont(new java.awt.Font ("SansSerif", 0, 8)) ; 286 jButton_Orange.setBorder(BorderFactory.createLoweredBevelBorder()) ; 287 jButton_Orange.setBorderPainted(false) ; 288 jButton_Orange.setFocusPainted(false) ; 289 jButton_Orange.setText("7") ; 290 jButton_Orange.addActionListener(new java.awt.event.ActionListener () 291 { 292 public void actionPerformed(ActionEvent e) 293 { 294 jButton_Orange_actionPerformed(e) ; 295 } 296 }) ; 297 this.getContentPane().add(jButton_Blanc, null) ; 298 this.getContentPane().add(jButton_Noir, null) ; 299 this.getContentPane().add(jButton_Bleu, null) ; 300 this.getContentPane().add(jButton_Vert, null) ; 301 this.getContentPane().add(jButton_RougeL, null) ; 302 this.getContentPane().add(jButton_Brun, null) ; 303 this.getContentPane().add(jButton_Pourpre, null) ; 304 this.getContentPane().add(jButton_Orange, null) ; 305 this.getContentPane().add(jButton_Jaune, null) ; 306 this.getContentPane().add(jButton_VertL, null) ; 307 this.getContentPane().add(jButton_CyanL, null) ; 308 this.getContentPane().add(jButton_Cyan, null) ; 309 this.getContentPane().add(jButton_BleuL, null) ; 310 this.getContentPane().add(jButton_Rose, null) ; 311 this.getContentPane().add(jButton_Gris, null) ; 312 this.getContentPane().add(jButton_GrisL, null) ; 313 this.setSize(120, 55) ; 314 } 315 316 void jButton_Noir_actionPerformed(ActionEvent e) 317 { 318 reagit(1) ; 319 } 320 321 void jButton_Blanc_actionPerformed(ActionEvent e) 322 { 323 reagit(0) ; 324 } 325 326 void jButton_Bleu_actionPerformed(ActionEvent e) 327 { 328 reagit(2) ; 329 } 330 331 void jButton_Vert_actionPerformed(ActionEvent e) 332 { 333 reagit(3) ; 334 } 335 336 void jButton_RougeL_actionPerformed(ActionEvent e) 337 { 338 reagit(4) ; 339 } 340 341 void jButton_Brun_actionPerformed(ActionEvent e) 342 { 343 reagit(5) ; 344 } 345 346 void jButton_Pourpre_actionPerformed(ActionEvent e) 347 { 348 reagit(6) ; 349 } 350 351 void jButton_Jaune_actionPerformed(ActionEvent e) 352 { 353 reagit(8) ; 354 } 355 356 void jButton_Orange_actionPerformed(ActionEvent e) 357 { 358 reagit(7) ; 359 } 360 361 void jButton_VertL_actionPerformed(ActionEvent e) 362 { 363 reagit(9) ; 364 } 365 366 void jButton_Cyan_actionPerformed(ActionEvent e) 367 { 368 reagit(11) ; 369 } 370 371 void jButton_CyanL_actionPerformed(ActionEvent e) 372 { 373 reagit(10) ; 374 } 375 376 void jButton_BleuL_actionPerformed(ActionEvent e) 377 { 378 reagit(12) ; 379 } 380 381 void jButton_Rose_actionPerformed(ActionEvent e) 382 { 383 reagit(13) ; 384 } 385 386 void jButton_Gris_actionPerformed(ActionEvent e) 387 { 388 reagit(14) ; 389 } 390 391 void jButton_GrisL_actionPerformed(ActionEvent e) 392 { 393 reagit(15) ; 394 } 395 396 void reagit(int color) 397 { 398 chatFrm = ircChan.getChatFrameWithFocus() ; 399 if (chatFrm != null) 400 { 401 JTextField tmp = ircChan.getChatFrameWithFocus().getTextBox() ; 402 if (tmp.getText().length() == 0) 403 { 404 tmp.setText(tmp.getText() + '\u0003' + "" + color) ; 405 } 406 else 407 { 408 tmp.setText(tmp.getText() + '\u0003' + "" + color) ; 409 } 410 } 411 } 412 413 public void setIrcConnexion(IRCconnexion ircConnexion) 414 { 415 this.ircChan = ircConnexion ; 416 } 417 418 } 419 | Popular Tags |