Hi, Following is my code: /* * Clicknbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txtto change this license
* Clicknbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to
editthis template
*/
packagecom.mycompany.validatename;
importjava.util.logging.Level;
importjava.util.logging.Logger;
importorg.apache.commons.validator.*;
importorg.apache.commons.validator.routines.InetAddressValidator;
importjava.util.regex.Matcher;
importjava.util.regex.Pattern;
importjavax.swing.JOptionPane;
importjavax.swing.UnsupportedLookAndFeelException;
/**
importorg.apache.commons.validator.routines.EmailValidator;
*
* @author zulfi
*/
public classValidateNameForm extends javax.swing.JFrame {
/**
* Creates newform ValidateNameForm
*/
publicValidateNameForm() {
initComponents();
}
/**
* This methodis called from within the constructor to initialize the form.
* WARNING: DoNOT modify this code. The content of this method is always
* regeneratedby the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-folddefaultstate="collapsed" desc="Generated Code">
private voidinitComponents() {
jButton1 =new javax.swing.JButton();
jTF1 = newjavax.swing.JTextField();
jLabel1 =new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Submit");
jButton1.addActionListener(new java.awt.event.ActionListener() {
publicvoid actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jTF1.addActionListener(new java.awt.event.ActionListener() {
publicvoid actionPerformed(java.awt.event.ActionEvent evt) {
jTF1ActionPerformed(evt);
}
});
jLabel1.setText("Name");
javax.swing.GroupLayout layout = newjavax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup()
.addContainerGap(182, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
67,javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTF1, javax.swing.GroupLayout.PREFERRED_SIZE,
91,javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(48, 48, 48))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup()
.addGap(74, 74, 74)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTF1, javax.swing.GroupLayout.PREFERRED_SIZE,
32,javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
32,javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,107,
Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(63, 63, 63))
);
pack();
}//</editor-fold>
private voidjTF1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO addyour handling code here:
}
private voidCheckIfInputValid(String input, String regex){
String s;
//for(inti=0; i<4; ++i) {
Patternpattern = Pattern.compile(regex);
s =input.trim();
Matchermatcher = pattern.matcher(s);
JOptionPane.showMessageDialog(null, "Input "+s+" isvalid " +
String.valueOf(matcher.matches()));
//}
}
private voidjButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO addyour handling code here:
StringemailAddress= jTF1.getText();
//StringstrInput[] = new String[5];
//strInput[0]= strAccName;
//Stringregex = "^[a-zA-Z]*$";
//StringemailRegex = regexArr[2]
="[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{1,6}))?";
booleanisValidEmail = EmailValidator.getInstance().isValid(emailAddress);
//CheckIfInputValid(strInput[0], emailRegex);
}
/**
* @param argsthe command line arguments
*/
public staticvoid main(String args[]) {
/* Set theNimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Lookand feel setting code
(optional) ">
/* If Nimbus(introduced in Java SE 6) is not available, stay with the
defaultlook and feel.
* Fordetails
seehttp://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for(javax.swing.UIManager.LookAndFeelInfo info
:javax.swing.UIManager.getInstalledLookAndFeels()) {
if("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch(ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ValidateNameForm.class.getName()).log(java.util.logging.Level.SEVERE,null,
ex);
} catch(InstantiationException ex) {
java.util.logging.Logger.getLogger(ValidateNameForm.class.getName()).log(java.util.logging.Level.SEVERE,null,
ex);
} catch(IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ValidateNameForm.class.getName()).log(java.util.logging.Level.SEVERE,null,
ex);
} catch(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ValidateNameForm.class.getName()).log(java.util.logging.Level.SEVERE,null,
ex);
}
//</editor-fold>
/* Createand display the form */
try {
for (javax.swing.UIManager.LookAndFeelInfo info
: javax.swing.UIManager.getInstalledLookAndFeels() ) {
if ("Nimbus".equals( info.getName() ) ) {
javax.swing.UIManager.setLookAndFeel( info.getClassName() );
break;
}
}
} catch (ClassNotFoundException | InstantiationException
|IllegalAccessException | UnsupportedLookAndFeelException ex ) {
Logger.getLogger( ValidateNameForm.class.getName() ).log(Level.SEVERE, null,
ex );
}
}
// Variablesdeclaration - do not modify
privatejavax.swing.JButton jButton1;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JTextField jTF1;
// End ofvariables declaration
//private voidinitComponents() {
// throw newUnsupportedOperationException( "Not supported yet." ); //Generated
fromnbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
// }
}
I have attached POM.xml and the error list.
Somebody, please guide me.
Zulfi.
outputafter seting the --debug--error2
Description: Binary data
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>m</groupId> <artifactId>emailvalidator</artifactId> <version>0.1</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <exec.mainClass>m.emailvalidator.Emailvalidator</exec.mainClass> <maven.compiler.release>21</maven.compiler.release> </properties> <dependencies> <!-- required dependency below --> <dependency> <groupId>commons-validator</groupId> <artifactId>commons-validator</artifactId> <version>1.8.0</version> <type>jar</type> </dependency> </dependencies> </project>
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
