1 23 24 package org.objectweb.fractal.gui.menu.control; 25 26 import org.objectweb.fractal.gui.model.ClientInterface; 27 import org.objectweb.fractal.gui.model.Component; 28 29 import java.awt.event.ActionEvent ; 30 import java.net.URL ; 31 32 import javax.swing.ImageIcon ; 33 import javax.swing.KeyStroke ; 34 35 38 39 public class NewClientInterfaceAction extends CreateAction { 40 41 44 45 public NewClientInterfaceAction () { 46 putValue(NAME, "New client interface"); 47 putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F7")); 48 URL url = getClass().getResource( 49 "/org/objectweb/fractal/gui/resources/empty.gif"); 50 putValue(SMALL_ICON, new ImageIcon (url)); 51 setEnabled(false); 52 } 53 54 58 public void selectionChanged () { 59 setEnabled(selection.getSelection() instanceof Component); 60 } 61 62 66 public void actionPerformed (final ActionEvent e) { 67 Object o = selection.getSelection(); 68 Component c = (Component)o; 69 ClientInterface i = factory.createClientInterface(c); 70 c.addClientInterface(i); 71 } 73 } 74 | Popular Tags |