Share on Google+Share on Google+

sushant
Admission Validation
1 Answer(s)      7 years ago
Posted in : Java Beginners
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.

Ads

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 Beginners
Admission 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 project
student 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 System
project 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 procedure
project 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 admission
college 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
validation
validation  validation
Tutorial college Student Admission System
Tutorial 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
validation
validation  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
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
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class="col1"> <label>Sno:</label> </td> <td
Student Admission Form in Java - Java Beginners
Student 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
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
Java Project for College Admission System - Java Beginners
Java Project for College Admission System  I want Project for Student Information System in Java Back end-MS Access plz Give Me source code or website to download it. plz Help Me
Java Project for College Admission System - Java Beginners
Java Project for College Admission System  Hello Sir I urgently wants College Admission Project in Java,with Back End Microsft Access 2007 ,sir plz Give me Full Source Code.  Could u give me the filed should
College Student Admission System Project in Java - Java Beginners
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
College Student Admission System Project in Java - Java Beginners
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
College Student Admission System Project in Java - Development process
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
validation files
validation files  If I place validation files in the folder where the action classes are present,will there any error arise
javascript validation
javascript validation  validation of comparing dropdownlist and textbox in javascript
NSURL Validation
NSURL Validation  How to validate a NSURL string using special character validation
form validation
form validation  how the form validation is done in jsf form using javaScript
validation query
validation query  where I should kept properties file inside struts Web application
Validation - Struts
Validation  what is the best way to use validation in Struts?either "validation.xml" or JavaScript
Validation of datepicker
Validation 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 validation
email 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
email validation
email 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
Date Validation
Date Validation  Hi, I need Date Validation using java in spring framework. Please Anyone help me... Thanks in advance
comboBox validation
comboBox validation  dear sir. i want to know . how to validate radio button in struts using xml validation. thanks
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads