private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed
        try {
            messageLabel.setText("");
            Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "oracle");
            Statement s = con.createStatement();

            String Name = name.getText();
            String IATA = iata.getText();
            String ci = city.getText();
            String reg = region.getText();
            String cou = country.getText();

            if (Name.equals("") || IATA.equals("") || ci.equals("") || reg.equals("") || cou.equals("")) {
                messageLabel.setText("All fields are mandatory!");
                con.close();
                return;
            }

            ResultSet rs = s.executeQuery("select apname,iatacode from airport");
            while (rs.next()) {
                if (rs.getString(1).equals(Name) || rs.getString(2).equals(IATA)) {
                    messageLabel.setText("Airport already exists!");
                    con.close();
                    return;
                }
            }
                     
            s.executeUpdate("insert into airport values(airport_id.NEXTVAL,'" + Name + "','" + IATA + "','" + ci +"','"+reg + "','" + cou + "')" );          
            name.setText(null);
            iata.setText(null);
            city.setText(null);
            region.setText(null);
            country.setText(null);
            javax.swing.JOptionPane.showMessageDialog(this, "Entered");
            con.close();
        } catch (SQLException se) {
            System.out.println(se);
            clear.setVisible(true);
        }

    }//GEN-LAST:event_okActionPerformed