1 package zirc.gui ; 2 3 import java.io.* ; 4 import java.util.* ; 5 import java.awt.* ; 6 import java.awt.event.* ; 7 import javax.swing.* ; 8 import javax.swing.border.* ; 9 import javax.swing.event.* ; 10 import zirc.base.* ; 11 import zirc.xml.* ; 12 import javax.swing.tree.DefaultMutableTreeNode ; 13 14 27 34 35 public class OptionDialog extends JDialog 36 { 37 private Locale language ; 38 private String defServText ; 39 private String selServText ; 40 private static ArrayList onConnectCommand = new ArrayList() ; 41 private XmlConfig xmlConf = new XmlConfig() ; 42 private OptionTree oTree ; 43 private String selectedNode ; 44 private MainFrame fenetre ; 45 private IRCconnexion ircConnexion ; 46 private String [][] list ; 47 private ArrayList al ; 48 private String selectedName, selectedDescription, selectedServer, defaultServer, 49 selectedServerPort, user_nick, user_email, user_name, user_QuitMSG, user_PartMSG ; 50 private DefaultListModel lm ; 51 private final File serverList = new File("fichiers/servers.ini") ; 52 private JSplitPane jSplitPane1 = new JSplitPane() ; 53 private JPanel jPanel1 = new JPanel() ; 54 private JPanel userOptionPanel = new JPanel() ; 55 private BorderLayout borderLayout1 = new BorderLayout() ; 56 private JPanel jPanel2 = new JPanel() ; 57 private JButton jbOptionDialogOk = new JButton() ; 58 private JButton jbOptionDialogCancel = new JButton() ; 59 private GridLayout gridLayout2 = new GridLayout() ; 60 private JPanel jPanel3 = new JPanel() ; 61 private JPanel jPanel4 = new JPanel() ; 62 private JPanel jPanel5 = new JPanel() ; 63 private JPanel jPanel6 = new JPanel() ; 64 private JPanel jPanel7 = new JPanel() ; 65 private JPanel jPanel8 = new JPanel() ; 66 private JPanel jPanel9 = new JPanel() ; 67 private JPanel jPanel10 = new JPanel() ; 68 private JTextField jtName = new JTextField() ; 69 private JTextField jtEmail = new JTextField() ; 70 private JTextField jtNick = new JTextField() ; 71 private JTextField jtReserve = new JTextField() ; 72 private JLabel jLabel1 = new JLabel() ; 73 private JLabel jLabel2 = new JLabel() ; 74 private JLabel jLabel3 = new JLabel() ; 75 private JLabel jLabel4 = new JLabel() ; 76 private JPanel serverOptionPanel = new JPanel() ; 77 private JList jlServer = new JList() ; 78 private JScrollPane jScrollPane1 = new JScrollPane() ; 79 private JButton jbOptionDialogEdit = new JButton() ; 80 private BorderLayout borderLayout2 = new BorderLayout() ; 81 JButton jbOptionDialogDefault = new JButton() ; 82 JTextArea jtServerInfos = new JTextArea() ; 83 FlowLayout flowLayout2 = new FlowLayout() ; 84 ServerEditDialog eDialog ; 85 private JPanel onConnectPanel = new JPanel() ; 86 private BorderLayout borderLayout3 = new BorderLayout() ; 87 private JPanel jPanel11 = new JPanel() ; 88 private JPanel jPanel12 = new JPanel() ; 89 private JScrollPane jScrollPane2 = new JScrollPane() ; 90 private BorderLayout borderLayout4 = new BorderLayout() ; 91 private JTextArea jtaOnConnect = new JTextArea() ; 92 private JTextArea jTextArea2 = new JTextArea() ; 93 private BorderLayout borderLayout5 = new BorderLayout() ; 94 private BorderLayout borderLayout6 = new BorderLayout() ; 95 private JPanel soundOptionPanel = new JPanel() ; 96 private JRadioButton jrSounds = new JRadioButton() ; 97 JPanel msgOptionPanel = new JPanel() ; 98 JTextField jtQuitMSG = new JTextField() ; 99 JLabel jLabel6 = new JLabel() ; 100 private Border border1 ; 101 102 public OptionDialog(Frame owner, IRCconnexion ircConnexion, MainFrame _fenetre, Locale _language) 103 { 104 super(owner) ; 105 this.ircConnexion = ircConnexion ; 106 language = _language ; 107 setLanguage(language) ; 108 eDialog = new ServerEditDialog(this, language) ; 109 this.fenetre = _fenetre ; 110 try 111 { 112 jbInit() ; 113 } 114 catch (Exception e) 115 { 116 e.printStackTrace() ; 117 } 118 } 119 120 private void jbInit() throws Exception 121 { 122 jtaOnConnect.setBorder(null) ; 123 oTree = new OptionTree(xmlConf) ; 124 border1 = BorderFactory.createLineBorder(Color.gray) ; 125 this.setSize(new Dimension(517, 362)) ; 126 this.addWindowFocusListener(new java.awt.event.WindowFocusListener () 127 { 128 public void windowGainedFocus(WindowEvent e) 129 { 130 } 131 132 public void windowLostFocus(WindowEvent e) 133 { 134 135 } 136 }) ; 137 this.addWindowFocusListener(new java.awt.event.WindowFocusListener () 138 { 139 public void windowGainedFocus(WindowEvent e) 140 { 141 this_windowGainedFocus(e) ; 142 } 143 144 public void windowLostFocus(WindowEvent e) 145 { 146 } 147 }) ; 148 this.getContentPane().setLayout(borderLayout1) ; 149 this.setModal(true) ; 150 this.setResizable(false) ; 151 this.setTitle("Options") ; 152 jSplitPane1.setOrientation(JSplitPane.HORIZONTAL_SPLIT) ; 153 jSplitPane1.setBorder(null) ; 154 jSplitPane1.setMaximumSize(new Dimension(250, 2147483647)) ; 155 jSplitPane1.setPreferredSize(new Dimension(78, 18)) ; 156 jSplitPane1.setToolTipText("") ; 157 jSplitPane1.setDividerSize(6) ; 158 jSplitPane1.setTopComponent(null) ; 159 oTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener () 160 { 161 public void valueChanged(TreeSelectionEvent e) 162 { 163 oTree_valueChanged(e) ; 164 } 165 }) ; 166 userOptionPanel.setLayout(gridLayout2) ; 167 jPanel2.setBorder(border1) ; 168 jPanel2.setPreferredSize(new Dimension(120, 40)) ; 169 jPanel2.setLayout(null) ; 170 jbOptionDialogOk.setBounds(new Rectangle(161, 6, 30, 25)) ; 171 jbOptionDialogOk.setBorder(border1) ; 172 jbOptionDialogOk.setActionCommand("Ok") ; 173 jbOptionDialogOk.setBorderPainted(true) ; 174 jbOptionDialogOk.setText("Ok") ; 175 jbOptionDialogOk.addActionListener(new java.awt.event.ActionListener () 176 { 177 public void actionPerformed(ActionEvent e) 178 { 179 jbOptionDialogOk_actionPerformed(e) ; 180 } 181 }) ; 182 jbOptionDialogCancel.setBounds(new Rectangle(295, 6, 59, 25)) ; 183 jbOptionDialogCancel.setBorder(border1) ; 184 jbOptionDialogCancel.setActionCommand("Annuler") ; 185 jbOptionDialogCancel.setText("Annuler") ; 186 jbOptionDialogCancel.addActionListener(new java.awt.event.ActionListener () 187 { 188 public void actionPerformed(ActionEvent e) 189 { 190 jbOptionDialogCancel_actionPerformed(e) ; 191 } 192 }) ; 193 gridLayout2.setColumns(2) ; 194 gridLayout2.setRows(4) ; 195 jtName.setBorder(border1) ; 196 jtName.setPreferredSize(new Dimension(120, 21)) ; 197 jtName.setText("") ; 198 jtName.addKeyListener(new java.awt.event.KeyAdapter () 199 { 200 public void keyReleased(KeyEvent e) 201 { 202 jtName_keyReleased(e) ; 203 } 204 }) ; 205 jtEmail.setText("") ; 206 jtEmail.addKeyListener(new java.awt.event.KeyAdapter () 207 { 208 public void keyReleased(KeyEvent e) 209 { 210 jtEmail_keyReleased(e) ; 211 } 212 }) ; 213 jtEmail.setBorder(border1) ; 214 jtEmail.setPreferredSize(new Dimension(120, 21)) ; 215 jtNick.setText("") ; 216 jtNick.addKeyListener(new java.awt.event.KeyAdapter () 217 { 218 public void keyReleased(KeyEvent e) 219 { 220 jtNick_keyReleased(e) ; 221 } 222 }) ; 223 jtNick.setBorder(border1) ; 224 jtNick.setPreferredSize(new Dimension(120, 21)) ; 225 jtReserve.setText("") ; 226 jtReserve.addKeyListener(new java.awt.event.KeyAdapter () 227 { 228 public void keyReleased(KeyEvent e) 229 { 230 jtReserve_keyReleased(e) ; 231 } 232 }) ; 233 jtReserve.setBorder(border1) ; 234 jtReserve.setPreferredSize(new Dimension(120, 21)) ; 235 jLabel1.setText("Nom:") ; 236 jLabel2.setText("Email:") ; 237 jLabel3.setText("Nick:") ; 238 jLabel4.setText("user reserve") ; 239 serverOptionPanel.setLayout(borderLayout2) ; 240 jPanel1.setLayout(borderLayout6) ; 241 jbOptionDialogEdit.setBorder(border1) ; 242 jbOptionDialogEdit.setText("Editer") ; 243 jbOptionDialogEdit.addActionListener(new java.awt.event.ActionListener () 244 { 245 public void actionPerformed(ActionEvent e) 246 { 247 jbOptionDialogEdit_actionPerformed(e) ; 248 } 249 }) ; 250 jbOptionDialogDefault.setBounds(new Rectangle(196, 6, 95, 25)) ; 251 jbOptionDialogDefault.setBorder(border1) ; 252 jbOptionDialogDefault.setText("Sauver par defaut") ; 253 jbOptionDialogDefault.addActionListener(new java.awt.event.ActionListener () 254 { 255 public void actionPerformed(ActionEvent e) 256 { 257 jbOptionDialogDefault_actionPerformed(e) ; 258 } 259 }) ; 260 jtServerInfos.setFont(new java.awt.Font ("SansSerif", 0, 12)) ; 261 jtServerInfos.setBorder(null) ; 262 jtServerInfos.setPreferredSize(new Dimension(250, 34)) ; 263 jtServerInfos.setEditable(false) ; 264 onConnectPanel.setLayout(borderLayout3) ; 265 jPanel12.setLayout(borderLayout4) ; 266 jTextArea2.setBackground(Color.lightGray) ; 267 jTextArea2.setFont(new java.awt.Font ("SansSerif", 0, 12)) ; 268 jTextArea2.setPreferredSize(new Dimension(70, 100)) ; 269 jTextArea2.setEditable(false) ; 270 jTextArea2.setText( 271 "Exemple:\nlist >10 \r\njoin #prog") ; 272 jTextArea2.setLineWrap(true) ; 273 jTextArea2.setWrapStyleWord(true) ; 274 jPanel11.setLayout(borderLayout5) ; 275 jScrollPane1.setBorder(null) ; 276 jScrollPane1.setPreferredSize(new Dimension(276, 220)) ; 277 jtaOnConnect.addKeyListener(new java.awt.event.KeyAdapter () 278 { 279 public void keyReleased(KeyEvent e) 280 { 281 jtaOnConnect_keyReleased(e) ; 282 } 283 }) ; 284 jrSounds.setText("Activer les sons") ; 285 286 jtQuitMSG.setText("jtQuitMSG") ; 287 jtQuitMSG.setBounds(new Rectangle(169, 84, 117, 24)) ; 288 jtQuitMSG.addKeyListener(new java.awt.event.KeyAdapter () 289 { 290 public void keyReleased(KeyEvent e) 291 { 292 jtQuitMSG_keyReleased(e) ; 293 } 294 }) ; 295 msgOptionPanel.setLayout(null) ; 296 jLabel6.setBounds(new Rectangle(64, 86, 82, 19)) ; 297 jLabel6.setText("QUIT message") ; 298 jLabel6.setHorizontalTextPosition(SwingConstants.CENTER) ; 299 jLabel6.setHorizontalAlignment(SwingConstants.LEFT) ; 300 jPanel11.setBorder(null) ; 301 jScrollPane2.setBorder(border1) ; 302 oTree.setBorder(border1) ; 303 oTree.setPreferredSize(new Dimension(90, 18)); 304 this.getContentPane().add(jSplitPane1, BorderLayout.CENTER) ; 305 this.getContentPane().add(jPanel2, BorderLayout.SOUTH) ; 306 jPanel2.add(jbOptionDialogOk, null) ; 307 jPanel2.add(jbOptionDialogDefault, null) ; 308 jPanel2.add(jbOptionDialogCancel, null) ; 309 userOptionPanel.add(jPanel3, null) ; 310 userOptionPanel.add(jPanel10, null) ; 311 jPanel10.add(jtName, null) ; 312 userOptionPanel.add(jPanel9, null) ; 313 userOptionPanel.add(jPanel8, null) ; 314 userOptionPanel.add(jPanel7, null) ; 315 userOptionPanel.add(jPanel4, null) ; 316 userOptionPanel.add(jPanel5, null) ; 317 userOptionPanel.add(jPanel6, null) ; 318 jPanel8.add(jtEmail, null) ; 319 jPanel4.add(jtNick, null) ; 320 jPanel6.add(jtReserve, null) ; 321 jPanel3.add(jLabel1, null) ; 322 jPanel9.add(jLabel2, null) ; 323 jPanel7.add(jLabel3, null) ; 324 jPanel5.add(jLabel4, null) ; 325 serverOptionPanel.add(jScrollPane1, BorderLayout.NORTH) ; 326 serverOptionPanel.add(jbOptionDialogEdit, BorderLayout.CENTER) ; 327 serverOptionPanel.add(jtServerInfos, BorderLayout.SOUTH) ; 328 jScrollPane1.getViewport().add(jlServer, null) ; 329 onConnectPanel.add(jPanel11, BorderLayout.NORTH) ; 330 jPanel11.add(jTextArea2, BorderLayout.CENTER) ; 331 onConnectPanel.add(jPanel12, BorderLayout.CENTER) ; 332 jPanel12.add(jScrollPane2, BorderLayout.CENTER) ; 333 jScrollPane2.getViewport().add(jtaOnConnect, null) ; 334 soundOptionPanel.add(jrSounds, null) ; 335 msgOptionPanel.add(jLabel6, null) ; 336 msgOptionPanel.add(jtQuitMSG, null) ; 337 jSplitPane1.setDividerLocation(140) ; 338 jSplitPane1.setRightComponent(jPanel1) ; 339 jSplitPane1.setLeftComponent(oTree) ; 340 jtServerInfos.setRows(2) ; 341 loadConfig() ; 342 } 343 344 private void loadConfig() 345 { 346 clearOnConnectCommand() ; 348 jtaOnConnect.setText("") ; 349 350 354 user_name = xmlConf.getUserName() ; 355 jtName.setText(user_name) ; 356 this.user_nick = xmlConf.getUserNick() ; 357 if (user_nick.length() == 0) 358 { 359 user_nick = "" ; 360 } 361 jtNick.setText(user_nick) ; 362 this.user_email = xmlConf.getUserEmail() ; 363 jtEmail.setText(user_email) ; 364 this.defaultServer = xmlConf.getServer() ; 365 jtServerInfos.setText(defServText + defaultServer) ; 366 this.selectedServerPort = xmlConf.getPorts() ; 367 this.onConnectCommand = xmlConf.getOnConnectActions() ; 368 jtaOnConnect.setText(this.onConnectCommand.get(0).toString()) ; 369 this.user_PartMSG = xmlConf.getUserPartMSG() ; 370 this.user_QuitMSG = xmlConf.getUserQuitMSG() ; 371 jtQuitMSG.setText(user_QuitMSG) ; 372 if (xmlConf.getSonIsEnabled().equals("vrai")) 373 { 374 jrSounds.setSelected(true) ; 375 } 376 else 377 { 378 jrSounds.setSelected(false) ; 379 } 380 381 al = new ArrayList() ; 385 BufferedReader in2 = null ; 386 String line ; 387 388 try 389 { 390 in2 = new BufferedReader(new FileReader(serverList)) ; 391 while ((line = in2.readLine()) != null) 393 { 394 al.add(line) ; 395 } 396 397 list = new String [al.size()][4] ; 399 for (int i = 0 ; i < list.length ; i++) 400 { 401 StringTokenizer str = new StringTokenizer(al.get(i).toString(), ":") ; 402 for (int j = 0 ; j < list[0].length ; j++) 403 { 404 list[i][j] = str.nextElement().toString() ; 405 } 406 } 407 } 408 catch (FileNotFoundException ex) 409 { 410 ex.printStackTrace() ; 411 } 412 catch (IOException ex1) 413 { 414 ex1.printStackTrace() ; 415 } 416 finally 417 { 418 try 419 { 420 in2.close() ; 421 } 422 catch (IOException ex1) 423 { 424 ex1.printStackTrace() ; 425 } 426 } 427 428 lm = new DefaultListModel() ; 429 for (int i = 0 ; i < list.length ; i++) 431 { 432 lm.addElement(list[i][0] + " " + list[i][1]) ; 433 } 434 jlServer.setBorder(null) ; 435 jlServer.setModel(lm) ; 436 jlServer.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) ; 437 jlServer.addListSelectionListener(new javax.swing.event.ListSelectionListener () 438 { 439 public void valueChanged(ListSelectionEvent e) 440 { 441 jlServer_valueChanged(e) ; 442 } 443 }) ; 444 } 445 446 void jbOptionDialogCancel_actionPerformed(ActionEvent e) 447 { 448 this.dispose() ; 449 } 450 451 void jbOptionDialogOk_actionPerformed(ActionEvent e) 452 { 453 this.dispose() ; 454 } 455 456 void jbOptionDialogEdit_actionPerformed(ActionEvent e) 458 { 459 eDialog.setLocation((int)this.getBounds().getX() + 40, (int)this.getBounds().getY() + 40) ; 460 eDialog.loadList() ; 461 eDialog.show() ; 462 } 463 464 void this_windowGainedFocus(WindowEvent e) 466 { 467 loadConfig() ; 468 } 469 470 void jbOptionDialogDefault_actionPerformed(ActionEvent e) 471 { 472 473 try 474 { 475 defaultServer = list[jlServer.getSelectedIndex()][2] ; } 477 catch (NullPointerException ex) 478 {} 479 catch (ArrayIndexOutOfBoundsException ex) 480 {} 481 jtServerInfos.setText(defServText + defaultServer) ; 482 483 if (user_name.length() == 0) 487 { 488 user_name = MessageBox.show(this, "Erreur", "Saisir un nom non nul!") ; 489 } 490 xmlConf.setUserName(this.user_name) ; 491 492 if (user_email.length() == 0) 493 { 494 user_email = MessageBox.show(this, "Erreur", "Saisir un email non nul!") ; 495 } 496 xmlConf.setUserEmail(this.user_email) ; 497 498 if (user_nick.length() == 0) 499 { 500 user_nick = MessageBox.show(this, "Erreur", "Saisir un nick non nul!") ; 501 } 502 xmlConf.setUserNick(this.user_nick) ; 503 504 if (user_PartMSG.length() == 0) 505 { 506 user_PartMSG = MessageBox.show(this, "Erreur", "Saisir un partMessage non nul!") ; 507 } 508 xmlConf.setUserPartMSG(user_PartMSG) ; 509 510 if (user_QuitMSG.length() == 0) 511 { 512 user_QuitMSG = MessageBox.show(this, "Erreur", "Saisir un quitMessage non nul!") ; 513 } 514 xmlConf.setUserQuitMSG(jtQuitMSG.getText()) ; 515 516 xmlConf.setPorts(this.selectedServerPort) ; 517 xmlConf.setServer(this.defaultServer) ; 518 519 if (jrSounds.isSelected()) 520 { 521 xmlConf.setSonsActives("vrai") ; 522 } 523 else 524 { 525 xmlConf.setSonsActives("faux") ; 526 } 527 xmlConf.setOnConnectActions(jtaOnConnect.getText()) ; 528 xmlConf.saveXmlConfig() ; 530 } 531 532 void jlServer_valueChanged(ListSelectionEvent e) 534 { 535 if (!e.getValueIsAdjusting()) 536 { 537 try 538 { 539 selectedName = list[jlServer.getSelectedIndex()][0] ; 540 selectedDescription = list[jlServer.getSelectedIndex()][1] ; 541 selectedServer = list[jlServer.getSelectedIndex()][2] ; 542 selectedServerPort = list[jlServer.getSelectedIndex()][3] ; 543 } 544 catch (ArrayIndexOutOfBoundsException ex) 545 {} 546 } 547 548 jtServerInfos.setText(defServText + defaultServer + "\n" + selServText + 549 selectedServer) ; 550 } 551 552 private static void clearOnConnectCommand() 554 { 555 onConnectCommand.clear() ; 556 } 557 558 563 public boolean isSoundEnabled() 564 { 565 return jrSounds.isSelected() ; 566 } 567 568 public static ArrayList getOnConnectCommand() 570 { 571 return onConnectCommand ; 572 } 573 574 public String getUser_server() 575 { 576 String server = selectedServer ; 577 try 578 { 579 if (!selectedServer.equals("")) 580 { 581 return selectedServer ; 582 } 583 } 584 catch (NullPointerException ex) 585 { 586 server = defaultServer ; 587 } 588 finally 589 { 590 return server ; 591 } 592 } 593 594 public String getUser_port() 595 { 596 return selectedServerPort ; 597 } 598 599 public String getUser_name() 600 { 601 return jtName.getText() ; 602 } 603 604 public String getUser_email() 605 { 606 return jtEmail.getText() ; 607 } 608 609 public String getUser_nick() 610 { 611 return jtNick.getText() ; 612 } 613 614 public String getUserPartMSG() 615 { 616 return this.user_PartMSG ; 617 } 618 619 public String getUserQuitMSG() 620 { 621 return this.user_QuitMSG ; 622 } 623 624 626 public static void setOnConnectCommand(String line) 627 { 628 onConnectCommand.add(line) ; 629 } 630 631 public void setUser_server(String _userServer) 632 { 633 selectedServer = _userServer ; 634 jtServerInfos.setText(defServText + selectedServer) ; 635 } 636 637 public void setUser_port(String _userPort) 638 { 639 selectedServerPort = _userPort ; 640 } 641 642 public void setUser_name(String _userName) 643 { 644 user_name = _userName ; 645 } 646 647 public void setUser_email(String _userEmail) 648 { 649 user_email = _userEmail ; 650 } 651 652 public void setUser_nick(String _userNick) 653 { 654 user_nick = _userNick ; 655 } 656 657 public void setLAF(String laf) throws UnsupportedLookAndFeelException, IllegalAccessException , InstantiationException , 659 ClassNotFoundException , NullPointerException 660 { 661 UIManager.setLookAndFeel(laf) ; 662 663 eDialog.setLAF(laf) ; 664 665 SwingUtilities.updateComponentTreeUI(this) ; 666 SwingUtilities.updateComponentTreeUI(userOptionPanel) ; 667 SwingUtilities.updateComponentTreeUI(serverOptionPanel) ; 668 SwingUtilities.updateComponentTreeUI(onConnectPanel) ; 669 SwingUtilities.updateComponentTreeUI(soundOptionPanel) ; 670 } 671 672 void oTree_valueChanged(TreeSelectionEvent e) 674 { 675 ResourceBundle messages = ResourceBundle.getBundle("OptionDialog", language) ; 676 selectedNode = oTree.getLastSelectedPathComponent().toString() ; 677 678 if (selectedNode.equals(messages.getString("nodeutilisateur"))) 679 { 680 invalidate() ; 681 jPanel1.removeAll() ; 682 jPanel1.add(userOptionPanel) ; 683 validate() ; 684 repaint() ; 685 } 686 687 if (selectedNode.equals(messages.getString("nodeserveurs"))) 688 { 689 invalidate() ; 690 jPanel1.removeAll() ; 691 jPanel1.add(serverOptionPanel) ; 692 validate() ; 693 repaint() ; 694 } 695 696 if (selectedNode.equals(messages.getString("nodeaction"))) 697 { 698 invalidate() ; 699 jPanel1.removeAll() ; 700 jPanel1.add(onConnectPanel) ; 701 validate() ; 702 repaint() ; 703 } 704 if (selectedNode.equals(messages.getString("nodesons"))) 705 { 706 invalidate() ; 707 jPanel1.removeAll() ; 708 jPanel1.add(soundOptionPanel) ; 709 validate() ; 710 repaint() ; 711 } 712 713 if (selectedNode.equals(messages.getString("nodemessages"))) 714 { 715 invalidate() ; 716 jPanel1.removeAll() ; 717 jPanel1.add(msgOptionPanel) ; 718 validate() ; 719 repaint() ; 720 } 721 722 } 723 724 void jtName_keyReleased(KeyEvent e) 725 { 726 user_name = jtName.getText() ; 727 } 728 729 void jtEmail_keyReleased(KeyEvent e) 730 { 731 user_email = jtEmail.getText() ; 732 } 733 734 void jtNick_keyReleased(KeyEvent e) 735 { 736 user_nick = jtNick.getText() ; 737 } 738 739 void jtReserve_keyReleased(KeyEvent e) 740 { 741 742 } 743 744 void jtaOnConnect_keyReleased(KeyEvent e) 745 { 746 onConnectCommand.clear() ; 747 setOnConnectCommand(jtaOnConnect.getText()) ; 748 } 749 750 void jtQuitMSG_keyReleased(KeyEvent e) 751 { 752 user_QuitMSG = jtQuitMSG.getText() ; 753 } 754 755 public void setLanguage(Locale lang) 756 { 757 try 758 { 759 language = lang ; 760 ResourceBundle messages = ResourceBundle.getBundle("OptionDialog", lang) ; 761 jLabel1.setText(messages.getString("nom")) ; 762 jbOptionDialogCancel.setText(messages.getString("btannuler")) ; 763 jbOptionDialogEdit.setText(messages.getString("btedit")) ; 764 jbOptionDialogDefault.setText(messages.getString("btdefaut")) ; 765 jrSounds.setText(messages.getString("sons")) ; 766 selServText = messages.getString("selserveur") ; 767 defServText = messages.getString("defserveur") ; 768 769 DefaultMutableTreeNode o = (DefaultMutableTreeNode )oTree.getModel().getChild(oTree.getModel().getRoot(), 0) ; 771 o.setUserObject(messages.getString("nodeutilisateur")) ; 772 o = (DefaultMutableTreeNode )oTree.getModel().getChild(oTree.getModel().getRoot(), 1) ; 773 o.setUserObject(messages.getString("nodeserveurs")) ; 774 o = (DefaultMutableTreeNode )oTree.getModel().getChild(oTree.getModel().getRoot(), 2) ; 775 o.setUserObject(messages.getString("nodeaction")) ; 776 o = (DefaultMutableTreeNode )oTree.getModel().getChild(oTree.getModel().getRoot(), 3) ; 777 o.setUserObject(messages.getString("nodesons")) ; 778 o = (DefaultMutableTreeNode )oTree.getModel().getChild(oTree.getModel().getRoot(), 4) ; 779 o.setUserObject(messages.getString("nodemessages")) ; 780 781 eDialog.setLanguage(lang) ; 783 } 784 catch (NullPointerException ex) 785 {} 786 787 } 788 789 } 790 | Popular Tags |