Admission Validation
Hello sir I have Designed Student Admission Form ,I want to Display Admission Status on Form that is Availbal Seats and Fillup Seats and when I FillUp 60 students in Access Databse I want to Show Status on Swing Application is that "ADMISSION FULL",How I can Show that plz Help Me Sir.
View Answers
April 8, 2010 at 12:30 PM
Hi Friend,
By retrieving the number of rows from the database table, you will come to know about the filled seats. If seats exceed 60, then display the message that 'ADMISSION FULL'.
Here is an example.
import java.sql.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
class StudentAdmissionForm{
JTextField txt;
public static void main(String[] args) throws Exception{
StudentAdmissionForm sf=new StudentAdmissionForm();
}
public StudentAdmissionForm(){
final JFrame f = new JFrame("Student Admission Form");
f.getContentPane().setLayout(null);
JLabel lbl1 = new JLabel("Name");
JTextField jt1=new JTextField(15);
JLabel lbl2 = new JLabel("Address");
JTextField jt2=new JTextField(15);
JLabel lbl3 = new JLabel("Gender");
txt=new JTextField();
JRadioButton Male,Female;
ButtonGroup radioGroup=new ButtonGroup();
Male=new JRadioButton("Male");
radioGroup.add(Male);
Female=new JRadioButton("Female");
radioGroup.add(Female);
Male.addActionListener(al);
Female.addActionListener(al);
JLabel lbl4=new JLabel("Date Of Birth");
JComboBox combo1=new JComboBox();
JComboBox combo2=new JComboBox();
JComboBox combo3=new JComboBox();
for(int i=1;i<=31;i++){
combo1.addItem(i);
}
for(int i=1;i<=12;i++){
combo2.addItem(i);
}
for(int i=1980;i<=2010;i++){
combo3.addItem(i);
}
JLabel lbl5=new JLabel("Contact No");
JTextField jt3=new JTextField(15);
JButton button=new JButton("Store");
lbl1.setBounds(50,50,70,30);
lbl2.setBounds(50,80,70,30);
lbl3.setBounds(50,110,70,30);
lbl4.setBounds(50,140,100,30);
lbl5.setBounds(50,170,100,30);
jt1.setBounds(170,50,200,25);
jt2.setBounds(170,80,200,25);
Male.setBounds(170,110,100,30);
Female.setBounds(270,110,100,30);
combo1.setBounds(170,140,50,25);
combo2.setBounds(270,140,50,25);
combo3.setBounds(370,140,80,25);
jt3.setBounds(170,170,200,25);
txt.setBounds(50,210,70,30);
button.setBounds(170,200,80,25);
f.add(lbl1);
f.add(lbl2);
f.add(lbl3);
f.add(lbl4);
f.add(lbl5);
f.add(jt1);
f.add(jt2);
f.add(jt3);
f.add(combo1);
f.add(combo2);
f.add(combo3);
f.add(Male);
f.add(Female);
f.add(button);
f.add(txt);
txt.setVisible(false);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try{
int count=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:access");
Statement st=con.createStatement();
ResultSet res = st.executeQuery("SELECT COUNT(*) FROM Register");
while (res.next()){
count = res.getInt(1);
}
if(count>60){
JOptionPane.showMessageDialog(null,"Admission Full");
f.setEnabled(false);
}
else{
//--------------------insert condition---------------------
}
}
catch(Exception ex){}
}
});
f.setSize(1000,1000);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent e) {
txt.setText(((JRadioButton) e.getSource()).getText());
}
};
}
Thanks
Related Tutorials/Questions & Answers:
Admission Validation - Java BeginnersAdmission Validation Hello sir I have Designed Student
Admission Form ,I want to Display
Admission Status on Form that is Availbal Seats and Fillup... on Swing Application is that "
ADMISSION FULL",How I can Show that plz Help Me Sir
Admission Procedure
Admission Procedure
Admission procedure is very simple due to on-line
admission facility. Just... the
admission form that can be get through clicking on the new user option
Advertisements
student admission system projectstudent
admission system project College Student
Admission System... Student
Admission Project in Java with Source code, that includes Following Forms 1) Student
Admission based,its urgent sir
project for Student Admission Systemproject for Student
Admission System I want Mini Java Project for Student
Admission System.
actually i want 2 know how 2 start this...please show me my way
project on admission procedureproject on
admission procedure how to get basic idea about this project...what are requirements that we need before doing this project??and will the length of the code be more
college student admissioncollege student admission Front End -JAVA
Back End - MS Access
Hello Sir, I want College Student
Admission Project in Java with Source code,
that includes Following Forms
1) Student
Admission based on Enterance Exam Marks
Tutorial college Student Admission SystemTutorial college Student
Admission System I want PHP Project for Student
Admission System. actually i want 2 know how 2 start this...please show me my way..... please send me synopsis
validationvalidation we are doing payroll system project in java.So pls provide the complete
validation code for employee master form
validation.....validation..... hi..........
thanks for ur reply for
validation code.
but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
Student Admission Form in Java - Java BeginnersStudent
Admission Form in Java I want to store following Information... of
admission
4)Fees
5)Payment Mode-with Combobox component(By Cheque,By Cash)
6)Education
7)Course
8)
Admission Type(Regular,External)
when i click
validation Validation method valid the in put. otherwise call the javascript onsubmit to check... code.Ok if you use struts then you can use
Validation method valid the in put
Validation);
JLabel label=new JLabel("JTable
validation Example",JLabel.CENTER);
JPanel panel=new JPanel();
panel.add(scroll);
JFrame frame=new JFrame("JTable
validation College Student Admission System Project in Java College Student
Admission System Project in Java Front End -JAVA
Back End - MS Access
Hello Sir, I want College Student
Admission Project in Java with Source code,
that includes Following Forms
1) Student
Admission based
validationvalidation please help me to check
validation for
<form>
<table class="form">
<tr>
<td class="col1">
<label>Sno:</label>
</td>
<td
validation filesvalidation files If I place
validation files in the folder where the action classes are present,will there any error arise
javascript validationjavascript validation
validation of comparing dropdownlist and textbox in javascript
form validationform validation how the form
validation is done in jsf form using javaScript
Validation - StrutsValidation what is the best way to use
validation in Struts?either "validation.xml" or JavaScript
validation queryvalidation query where I should kept properties file inside struts Web application
NSURL ValidationNSURL Validation How to validate a NSURL string using special character
validation email validationemail validation during email
validation.... after domain name which it means if example
[email protected] .... this address allowed by any
validation program .... but i want to show invalid email address because domain name com
Validation of datepickerValidation of datepicker I have a datepicker in my JSp...the seleted dates are put in a text box. I want the alert the user from selecting future... a future date is entered..How to do this
validation in javascript or jsp
email validationemail validation during email
validation.... after domain name which it means if example
[email protected] .... this address allowed by any
validation program .... but i want to show invalid email address because domain name com
Form ValidationForm Validation Java script
validation for checking special characters and white spaces and give an alert.Please help me urgent
Thanks in advance
comboBox validationcomboBox validation dear sir.
i want to know . how to validate radio button in struts using xml
validation.
thanks
Date ValidationDate Validation Hi,
I need Date
Validation using java in spring framework. Please Anyone help me...
Thanks in advance
date validationdate validation sir,
pls provide date
validation code in javascript..we want to include it into our master form..
Please visit the following link:
http://www.roseindia.net/mysql/datevalidation.shtml
validation - Frameworkvalidation how to validate the action forms in struts? could you please explain how cross
validation is done for date? You go the following url: http://www.roseindia.net/struts/struts-login-form.shtml
Struts validationStruts validation I want to put
validation rules on my project.But after following all the rules I can't find the result.
I have extended...
validation rules,put the plugins inside strutsconfig.xml, put the html:errors tag
Validation - StrutsValidation How can i use
validation framework i don't understand am...; Hi friend,
Phone
validation using javaScript
function...
return true;
}
Phone
Validation Validation doubtValidation doubt hi.....
thanks for the other
validation code. I have got that and implemented in my code but i have a doubt in that.
As we try to put string values its not allowing to do tht it gives us message its right
Server side validation vs client side validationServer side
validation vs client side validation Can any one tell me the difference between these two different ways of
Validation? Also features of Server side
validation vs client side
validation.
The client side
Struts2 validation ProcedureStruts2
validation Procedure In struts2 Which one is best XML
Validation or Programatic
validation? and which one is used in real world application
Struts2 validation ProcedureStruts2
validation Procedure In struts2 Which one is best XML
Validation or Programatic
validation? and which one is used in real world application
Struts2 validation ProcedureStruts2
validation Procedure In struts2 Which one is best XML
Validation or Programatic
validation? and which one is used in real world application