1 19 27 28 package org.netbeans.modules.websvc.customization.multiview; 29 30 import java.awt.event.KeyAdapter ; 31 import java.awt.event.KeyEvent ; 32 import javax.swing.JTextField ; 33 import org.openide.DialogDisplayer; 34 import org.openide.NotifyDescriptor; 35 import org.openide.util.NbBundle; 36 37 41 class IdentifierKeyListener extends KeyAdapter { 42 JTextField classText; 43 public IdentifierKeyListener(JTextField classText){ 44 this.classText = classText; 45 } 46 47 public void keyTyped(KeyEvent e){ 48 char c = e.getKeyChar(); 49 String val = classText.getText() + String.valueOf(c); 50 if(!val.trim().equals("") &&( 51 !JavaUtilities.isValidTypeIdentifier(val))){ 52 NotifyDescriptor.Message notifyDesc = 53 new NotifyDescriptor.Message(NbBundle.getMessage(PortTypePanel.class, "ERR_INVALID_IDENTIFIER", val), 54 NotifyDescriptor.ERROR_MESSAGE); 55 DialogDisplayer.getDefault().notify(notifyDesc); 56 e.consume(); 57 } 58 } 59 } 60 | Popular Tags |