Dear Zulfi,

If you do not follow up earlier advice, I see no point in helping any
further.
In the error message it says release version 21 and your runtime is 11.
Make them match. Either by installing and using Java 21 or by deleting the
line in the pom
which says 21.
What is the purpose of this exercise? is it for school. If so study a bit
more diligently.


met vriendelijke groet
Pieter van den Hombergh

Op za 27 jan 2024 06:31 schreef Zulfi Khan <zulfi6...@yahoo.com.invalid>:

> Hi,
>
> Following is my code:
>
> /*
>
> * Click
> nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
> change this license
>
> * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to
> edit this template
>
> */
>
> package com.mycompany.validatename;
>
> import java.util.logging.Level;
>
> import java.util.logging.Logger;
>
> import org.apache.commons.validator.*;
>
> import org.apache.commons.validator.routines.InetAddressValidator;
>
> import java.util.regex.Matcher;
>
> import java.util.regex.Pattern;
>
> import javax.swing.JOptionPane;
>
> import javax.swing.UnsupportedLookAndFeelException;
>
> /**
>
> import org.apache.commons.validator.routines.EmailValidator;
>
>
>
> *
>
> * @author zulfi
>
> */
>
> public class ValidateNameForm extends javax.swing.JFrame {
>
>
> /**
>
> * Creates new form ValidateNameForm
>
> */
>
> public ValidateNameForm() {
>
> initComponents();
>
> }
>
>
> /**
>
> * This method is called from within the constructor to initialize the form.
>
> * WARNING: Do NOT modify this code. The content of this method is always
>
> * regenerated by the Form Editor.
>
> */
>
> @SuppressWarnings("unchecked")
>
> // <editor-fold defaultstate="collapsed" desc="Generated Code">
>
> private void initComponents() {
>
>
> jButton1 = new javax.swing.JButton();
>
> jTF1 = new javax.swing.JTextField();
>
> jLabel1 = new javax.swing.JLabel();
>
>
> setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
>
>
> jButton1.setText("Submit");
>
> jButton1.addActionListener(new java.awt.event.ActionListener() {
>
> public void actionPerformed(java.awt.event.ActionEvent evt) {
>
> jButton1ActionPerformed(evt);
>
> }
>
> });
>
>
> jTF1.addActionListener(new java.awt.event.ActionListener() {
>
> public void actionPerformed(java.awt.event.ActionEvent evt) {
>
> jTF1ActionPerformed(evt);
>
> }
>
> });
>
>
> jLabel1.setText("Name");
>
>
> javax.swing.GroupLayout layout = new
> javax.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 void jTF1ActionPerformed(java.awt.event.ActionEvent evt) {
>
> // TODO add your handling code here:
>
> }
>
> private void CheckIfInputValid(String input, String regex){
>
> String s;
>
> //for(int i=0; i<4; ++i) {
>
> Pattern pattern = Pattern.compile(regex);
>
>
> s = input.trim();
>
>
> Matcher matcher = pattern.matcher(s);
>
>
> JOptionPane.showMessageDialog(null, "Input "+s+" is valid " +
> String.valueOf(matcher.matches()));
>
> //}
>
> }
>
> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
>
> // TODO add your handling code here:
>
> String emailAddress= jTF1.getText();
>
> //String strInput[] = new String[5];
>
> //strInput[0]= strAccName;
>
> //String regex = "^[a-zA-Z]*$";
>
> //String emailRegex = regexArr[2] =
> "[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{1,6}))?";
>
> boolean isValidEmail = EmailValidator.getInstance().isValid(emailAddress);
>
> //CheckIfInputValid(strInput[0], emailRegex);
>
> }
>
>
> /**
>
> * @param args the command line arguments
>
> */
>
> public static void main(String args[]) {
>
> /* Set the Nimbus look and feel */
>
> //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
> (optional) ">
>
> /* If Nimbus (introduced in Java SE 6) is not available, stay with the
> default look and feel.
>
> * For details see
> http://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>
>
>
> /* Create and 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 );
>
> }
>
> }
>
>
> // Variables declaration - do not modify
>
> private javax.swing.JButton jButton1;
>
> private javax.swing.JLabel jLabel1;
>
> private javax.swing.JTextField jTF1;
>
> // End of variables declaration
>
>
> //private void initComponents() {
>
> // throw new UnsupportedOperationException( "Not supported yet." ); //
> Generated from
> nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
>
> // }
>
> }
>
>
> I have attached POM.xml and the error list.
>
> Somebody, please guide me.
>
> Zulfi.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to