1 26 27 package org.objectweb.ccm.chat.explorer; 28 29 import javax.swing.JOptionPane ; 30 31 import org.objectweb.ccm.chat.Client; 32 import org.objectweb.ccm.chat.ClientHome; 33 import org.objectweb.util.explorer.api.MenuItemTreeView; 34 import org.objectweb.util.explorer.api.MenuItem; 35 import org.objectweb.util.explorer.api.TreeView; 36 37 38 43 public class ClientCreationAction 44 implements MenuItem 45 { 46 47 public int getStatus(TreeView treeView){ 48 return MenuItem.ENABLED_STATUS; 49 } 50 51 public void actionPerformed(MenuItemTreeView e) throws Exception { 52 String name = ""; 53 while (name != null && name.equals("")) { 54 name = JOptionPane.showInputDialog("Enter the client name:"); 55 } 56 if (name != null) { 57 ClientHome client = (ClientHome) e.getSelectedObject(); 58 Client c = client.create(); 59 c.name(name); 60 } 61 } 62 63 } 64 | Popular Tags |