Problem with Java Source Code
Dear Sir I have Following Source Code ,But There is Problem with classes,
plz Help Me.
package mes.gui;
import javax.swing.JOptionPane.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import javax.swing.Timer;
import java.util.*;
import java.text.SimpleDateFormat;
import javax.swing.text.MaskFormatter;
import java.text.*;
import mes.util.*;
import mes.dbase.*;
import mes.gui.*;
public class StudentMaster extends MESFrame implements ActionListener{
MainFrame parent;
showStudentList studList;
String custno="",compname="";
JTextField ID,FirstName,LastName,Address,Email,Father,Mother,Contact,imageField;
JComboBox cboEStatus,cboSY,cbReligion,cbCitizenship,cbCStatus,cbGender,cbCourse,cbYearLevel,cboSemester;
JTextField ParentsAddress,ParentsContactNo;
JFormattedTextField BirthDate,EnrollmentDate;
JTextField MiddleName;
JLabel id;
JComboBox cboSection;
JTextField School1,School2,School3;
JTextField Address1,Address2,Address3;
JTextField Graduated1,Graduated2,Graduated3;
String url="jdbc:mysql://192.168.1.37/dbmaster";
String driver ="org.gjt.mm.mysql.Driver";
String username="root";
String password="rose";
Statement statement;
Connection connection;
ResultSet rs;
private int count1=0,count2=0,count3=0,count4=0;
int cnt=1;
JLabel ImageLabel;
String imagename = "steam.gif";
ImageIcon ii = new ImageIcon(imagename);
String customerCounter="";
public StudentMaster(MainFrame main,showStudentList paramStudList){
super(390,300,"", new String[] {"Add","Save","Search","Edit","Cancel","Update","Close"});
parent = main;
studList=paramStudList;
init();
setTitle("Student Enrollment Master File");
setVisible(true);
}
void init(){
addButtonActionListener(this);
MAINPANEL.setLayout(null);
JLabel recLabel=new JLabel("");
// MAINPANEL.add(recLabel).setBounds(5,15,730,440);
// recLabel.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
id=new JLabel("ID#:");
MAINPANEL.add(id).setBounds(30,20,100,23);
id.setFont(new Font("Verdana",Font.BOLD,13));
ID=new JTextField();
MAINPANEL.add(ID).setBounds(118,20,180,23);
ID.setEditable(false);
// JLabel t1=new JLabel("Student Master Record");
// MAINPANEL.add(t1).setBounds(270,0,200,25);
// t1.setFont(new Font("Verdana",Font.BOLD,14));
JLabel t4=new JLabel("FirstName");
MAINPANEL.add(t4);
t4.setFont(new Font("Verdana",Font.PLAIN,13));
t4.setBounds(30,50,100,20);
JLabel t5=new JLabel("LastName");
MAINPANEL.add(t5);
t5.setFont(new Font("Verdana",Font.PLAIN,13));
t5.setBounds(30,80,100,20);
JLabel t6=new JLabel("Address");
MAINPANEL.add(t6);
t6.setFont(new Font("Verdana",Font.PLAIN,13));
t6.setBounds(30,110,100,20);
JLabel t7=new JLabel("EmailAddress");
MAINPANEL.add(t7);
t7.setFont(new Font("Verdana",Font.PLAIN,13));
t7.setBounds(30,140,100,20);
JLabel t8=new JLabel("Father");
MAINPANEL.add(t8);
t8.setFont(new Font("Verdana",Font.PLAIN,13));
t8.setBounds(30,170,100,20);
JLabel t9=new JLabel("Birth Date");
MAINPANEL.add(t9).setBounds(305,50,180,23);
t9.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t32=new JLabel("MI");
MAINPANEL.add(t32).setBounds(305,20,180,23);
t32.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t33=new JLabel("Section");
MAINPANEL.add(t33).setBounds(420,20,180,23);
t33.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t34=new JLabel("Enroll Status");
MAINPANEL.add(t34).setBounds(585,20,180,23);
t34.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t10=new JLabel("Religion");
MAINPANEL.add(t10).setBounds(305,80,180,23);
t10.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t11=new JLabel("Gender");
MAINPANEL.add(t11).setBounds(490,50,180,23);
t11.setFont(new Font("Verdana",Font.PLAIN,13));
ImageLabel=new JLabel(" ", ii ,JLabel.CENTER);//---default image
MAINPANEL.add(ImageLabel).setBounds(570,45,145,125);
ImageLabel.setFont(new Font("Verdana",Font.PLAIN,13));
ImageLabel.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED) );
JLabel t13=new JLabel("Contact#");
MAINPANEL.add(t13).setBounds(370,110,80,23);
t13.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t14=new JLabel("Citizenship");
MAINPANEL.add(t14).setBounds(370,140,80,23);
t14.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t15=new JLabel("Mother");
MAINPANEL.add(t15);
t15.setFont(new Font("Verdana",Font.PLAIN,13));
t15.setBounds(30,200,100,20);
JLabel t16=new JLabel("Education");
MAINPANEL.add(t16);
t16.setFont(new Font("Verdana",Font.BOLD,12));
t16.setBounds(30,270,200,20);
JLabel t17=new JLabel("Name of School");
MAINPANEL.add(t17);
t17.setFont(new Font("Verdana",Font.BOLD,12));
t17.setBounds(170,270,200,20);
JLabel t18=new JLabel("Address");
MAINPANEL.add(t18);
t18.setFont(new Font("Verdana",Font.BOLD,12));
t18.setBounds(420,270,200,20);
JLabel t19=new JLabel("Date Graduated");
MAINPANEL.add(t19);
t19.setFont(new Font("Verdana",Font.BOLD,12));
t19.setBounds(590,270,200,20);
JLabel t20=new JLabel("Elementary");
MAINPANEL.add(t20);
t20.setFont(new Font("Verdana",Font.BOLD,12));
t20.setBounds(30,300,200,20);
JLabel t21=new JLabel("Secondary");
MAINPANEL.add(t21);
t21.setFont(new Font("Verdana",Font.BOLD,12));
t21.setBounds(30,330,200,20);
JLabel t22=new JLabel("College");
MAINPANEL.add(t22);
t22.setFont(new Font("Verdana",Font.BOLD,12));
t22.setBounds(30,360,200,20);
JLabel t23=new JLabel("Image");
MAINPANEL.add(t23).setBounds(370,200,80,23);
t23.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t24=new JLabel("Status");
MAINPANEL.add(t24).setBounds(370,170,80,23);
t24.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t25=new JLabel("Course");
MAINPANEL.add(t25).setBounds(550,170,80,23);
t25.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t26=new JLabel("Year Level");
MAINPANEL.add(t26).setBounds(550,200,80,23);
t26.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t30=new JLabel("Sem");
MAINPANEL.add(t30).setBounds(550,230,80,23);
t30.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t31=new JLabel("SY");
MAINPANEL.add(t31).setBounds(660,230,80,23);
t31.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t27=new JLabel("Parent's");
MAINPANEL.add(t27).setBounds(30,230,200,24);
t27.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t29=new JLabel("Address");
MAINPANEL.add(t29).setBounds(30,245,200,24);
t29.setFont(new Font("Verdana",Font.PLAIN,13));
JLabel t28=new JLabel("Contact#");
MAINPANEL.add(t28).setBounds(370,230,200,24);
t28.setFont(new Font("Verdana",Font.PLAIN,13));
//MAINPANEL.add(imageField).setBounds(440,230,100,23);
JMenuBar mbar=new JMenuBar();
MAINPANEL.add(mbar).setBounds(20,270,700,25);
mbar.setBackground(new Color(255,255,192));
mbar.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
FirstName =new JTextField();
LastName =new JTextField();
Address =new JTextField();
Email =new JTextField();
MiddleName=new JTextField();
//apply maskformatter
try
{
MaskFormatter m=new MaskFormatter("##/##/##");
BirthDate=new JFormattedTextField(m);
}
catch(Exception e)
{
}
// try
/// {
/// MaskFormatter m2=new MaskFormatter("##/##/##");
// EnrollmentDate=new JFormattedTextField(m2);
//}
//catch(Exception e)
//{
// }
//BirthDate=new JTextField();
cboSection=new JComboBox();
cboSection.addItem("Section-A");
cboSection.addItem("Section-B");
cboSection.addItem("Section-C");
cboSection.addItem("Section-D");
cbReligion=new JComboBox();
cbReligion.addItem("Catholic");
cbReligion.addItem("Islam");
cbReligion.addItem("Protestant");
cbReligion.addItem("Jehovahs Witnesses");
cbReligion.addItem("N/A");
cbGender=new JComboBox();
cbGender.addItem("Male");
cbGender.addItem("Female");
cbCitizenship=new JComboBox();
cbCitizenship.addItem("Filipino");
cbCitizenship.addItem("Foreigner");
cbCStatus=new JComboBox();
cbCStatus.addItem("Single");
cbCStatus.addItem("Married");
cbCStatus.addItem("Divorce");
cbCourse=new JComboBox();
cbCourse.addItem("DCS");
cbCourse.addItem("DEP");
cbCourse.addItem("DIT");
cbCourse.addItem("DCET");
cbYearLevel=new JComboBox();
cbYearLevel.addItem("1st");
cbYearLevel.addItem("2nd");
cboSemester=new JComboBox();
cboSemester.addItem("1st");
cboSemester.addItem("2nd");
cboSY=new JComboBox();
cboSY.addItem("06/07");
cboSY.addItem("07/08");
cboSY.addItem("08/09");
cboEStatus=new JComboBox();
cboEStatus.addItem("New");
cboEStatus.addItem("Old");
cboEStatus.addItem("Transferee");
Father =new JTextField();
Mother =new JTextField();
Contact=new JTextField();
School1 =new JTextField();
School2 =new JTextField();
School3 =new JTextField();
Address1 =new JTextField();
Address2 =new JTextField();
Address3 =new JTextField();
Graduated1 =new JTextField();
Graduated2 =new JTextField();
Graduated3 =new JTextField();
imageField=new JTextField();
ParentsAddress=new JTextField();
ParentsContactNo=new JTextField();
MAINPANEL.add(FirstName).setBounds(118,50,180,23);
MAINPANEL.add(LastName).setBounds(118,80,180,23);
MAINPANEL.add(Address).setBounds(118,110,240,23);
MAINPANEL.add(Email).setBounds(118,140,240,23);
MAINPANEL.add(BirthDate).setBounds(380,50,100,23);
MAINPANEL.add(MiddleName).setBounds(350,20,60,23);
// MAINPANEL.add(EnrollmentDate).setBounds(520,20,60,23);
MAINPANEL.add(cboSection).setBounds(480,20,100,23);
MAINPANEL.add(cboEStatus).setBounds(680,20,80,23);
MAINPANEL.add(cbReligion).setBounds(380,80,100,23);
MAINPANEL.add(cbGender).setBounds(490,80,70,23);
MAINPANEL.add(Father).setBounds(118,170,240,23);
MAINPANEL.add(Mother).setBounds(118,200,240,23);
MAINPANEL.add(Contact).setBounds(440,110,125,23);
MAINPANEL.add(cbCitizenship).setBounds(440,140,125,23);
MAINPANEL.add(cbCStatus).setBounds(440,170,100,23);
MAINPANEL.add(cbCourse).setBounds(620,172,80,23);
MAINPANEL.add(cbYearLevel).setBounds(620,200,80,23);
MAINPANEL.add(cboSemester).setBounds(590,230,60,23);
MAINPANEL.add(cboSY).setBounds(680,230,60,23);
MAINPANEL.add(School1).setBounds(118,300,230,23);
MAINPANEL.add(School2).setBounds(118,330,230,23);
MAINPANEL.add(School3).setBounds(118,360,230,23);
MAINPANEL.add(Address1).setBounds(347,300,250,23);
MAINPANEL.add(Address2).setBounds(347,330,250,23);
MAINPANEL.add(Address3).setBounds(347,360,250,23);
MAINPANEL.add(Graduated1).setBounds(597,300,100,23);
MAINPANEL.add(Graduated2).setBounds(597,330,100,23);
MAINPANEL.add(Graduated3).setBounds(597,360,100,23);
MAINPANEL.add(imageField).setBounds(440,200,100,23);
MAINPANEL.add(ParentsAddress).setBounds(118,230,250,24);
MAINPANEL.add(ParentsContactNo).setBounds(440,230,100,24);
//disable_fields
disable_fields();
disable_OnLoad();
}//=====end of constructor//
public void actionPerformed(ActionEvent event){
String act = event.getActionCommand();
if(act.equals("Close")){
dispose();
// disabledFields();
}else if(act.equals("Save")){
save();
}
else if(act.equals("Search"))
{
searchRECORD();
}
else if(act.equals("Add"))
{
enable_fields();
clear_fields();
disabled_OnAdd();
}
else if(act.equals("Cancel"))
{
enabled_OnCancel();
disable_fields();
}
else if(act.equals("Edit"))
{
// disabled_onEdit();
onEdit();
}
else if(act.equals("Update"))
{
updateRecord();
}
}
void save(){
if(! complete()){
JOptionPane.showMessageDialog(this, "ALL INFORMATION IS REQUIRED!","DATA REQUIRED?", JOptionPane.WARNING_MESSAGE);
return;
}
try
{
Class.forName(driver);
connection=DriverManager.getConnection(url,username,password);
statement=connection.createStatement();
String query="SELECT IDNumber FROM studentmaster";
rs=statement.executeQuery(query);
cnt = 1;
count3=0;
count4=0;
count2=0;
while(rs.next())
{
cnt++;
if((cnt==10))
{
cnt=0;
count3=count3+1;
}
//Please Read:If the Records is equal to 0099 the cnt variable must be
//change to this code below.You must input the 0099 records manually to be able
//to get the target number to 100 other wise it won't work.
//Bernardo D. Tongcos Jr. 10/25/2006
else if((cnt==9)&&(count3==9)||(cnt==10))
// else if((cnt==9)&&(count3==9)||(cnt==10)||(count3==7)||(count3==8))
{
cnt=0;
cnt-=1;
//cnt=0;
count3=0;
count4=count4+1;
}
// if((cnt==9)&&(count3==9))
// {
// cnt=0;
// count3=0;
// count4=count4+1;
// }
else if((cnt==9)&&(count2==9))
{
cnt=0;
count3=0;
count4=0;
count2=count2+1;
}//end of if
}//end of while
}//end of try
catch(ClassNotFoundException c)
{
System.err.println(c);
}
catch(SQLException sqle)
{
System.err.println(sqle);
}
String STUDID = "116-2006-"+count1+count4+count3+cnt;
String fname =FirstName.getText();
String lname =LastName.getText();
String address=Address.getText();
String email =Email.getText();
String father =Father.getText();
String mother =Mother.getText();
String parentsaddress=ParentsAddress.getText();
String birthdate=BirthDate.getText();
String religion=cbReligion.getSelectedItem().toString();
String gender=cbGender.getSelectedItem().toString();
String contact=Contact.getText();
String citizenship=cbCitizenship.getSelectedItem().toString();
String cstatus=cbCStatus.getSelectedItem().toString();
String image=imageField.getText();
String course=cbCourse.getSelectedItem().toString();
String yearlevel=cbYearLevel.getSelectedItem().toString();
String parentscontactno=ParentsContactNo.getText();
String school1=School1.getText();
String address1=Address1.getText();
String graduated1=Graduated1.getText();
String school2=School2.getText();
String address2=Address2.getText();
String graduated2=Graduated2.getText();
String school3=School3.getText();
String address3=Address3.getText();
String graduated3=Graduated3.getText();
String semester=cboSemester.getSelectedItem().toString();
String CStatus=cbCStatus.getSelectedItem().toString();
String sy=cboSY.getSelectedItem().toString();
// String strEDate=EnrollmentDate.getText();
String eStatus=cboEStatus.getSelectedItem().toString();
String strSection=cboSection.getSelectedItem().toString();
String sql = "INSERT INTO studentmaster(IDNumber,FirstName,LastName,Address,Email,Father,Mother,ParentsAddress,BirthDate,Religion,Gender,ContactNo,Citizenship,Status,Image,Course,YearLevel,ParentsContactNo,School1,Address1,Graduated1,School2,Address2,Graduated2,School3,Address3,Graduated3,Sem,SY,MI,EnrollmentStatus,Section)VALUES('"+STUDID+"','"+fname+"','"+lname+"','"+address+"','"+email+"','"+father+"','"+mother+"','"+parentsaddress+"','"+birthdate+"','"+religion+"','"+gender+"','"+contact+"','"
+citizenship+"','"+cstatus+"','"+image+"','"+course+"','"+yearlevel+"','"+parentscontactno+"','"+school1+"','"+address1+"','"+graduated1+"','"+school2+"','"+address2+"','"+graduated2+"','"+school3+"','"+address3+"','"+graduated3+"','"+semester+"','"+sy+"','"+MiddleName.getText()+"','"+eStatus+"','"+strSection+"')";
int update = parent.database.executeUpdate(sql);
if(update ==0)
{
Hashtable h = new Hashtable();
h.put("IDNumber",STUDID);
h.put("FirstName",fname);
h.put("LastName",lname);
h.put("Address",address);
h.put("Gender",gender);
h.put("Course",course);
h.put("YearLevel",yearlevel);
h.put("Sem",semester);
h.put("SY",sy);
h.put("Section",strSection);
h.put("Status",CStatus);
parent.getCollection("studentmaster").add(h);
}
else
{
return;
}
dispose();
studList.fillTable();
}
void searchRECORD()
{
String srcKey=JOptionPane.showInputDialog(null,"TYPE STUDENT NO. OR LASTNAME TO SEARCH");
String msg="RECORD NOT FOUND!\n"
+"PLEASE TRY AGAIN AND CHECK YOUR SPELLING\n";
try
{
Class.forName(driver);
connection=DriverManager.getConnection(url,username,password);
statement=connection.createStatement();
String query="SELECT IDNumber,FirstName,LastName,Address,Email,Father,Mother,ParentsAddress,BirthDate,Religion,Gender,ContactNo,Citizenship,Status,Image,Course,YearLevel,ParentsContactNo,School1,Address1,Graduated1,School2,Address2,Graduated2,School3,Address3,Graduated3,Sem,SY,MI,EnrollmentStatus,Section FROM StudentMaster WHERE IDNumber='"+srcKey+"' OR LastName='"+srcKey+"'";
rs=statement.executeQuery(query);
rs.next();//next row
ID.setText(rs.getString(1));
FirstName.setText(rs.getString(2) );
LastName.setText(rs.getString(3) );
Address.setText(rs.getString(4) );
Email.setText(rs.getString(5) );
Father.setText(rs.getString(6));
Mother.setText(rs.getString(7));
ParentsAddress.setText(rs.getString(8));
BirthDate.setText(rs.getString(9));
String strReligion=rs.getString(10);
cbReligion.setSelectedItem(strReligion);
String strGender=rs.getString(11);
cbGender.setSelectedItem(strGender);
Contact.setText(rs.getString(12));
String strCitizenship=rs.getString(13);
cbCitizenship.setSelectedItem(strCitizenship);
String strCStatus=rs.getString(14);
cbCStatus.setSelectedItem(strCStatus);
imagename=rs.getString(15);
imageField.setText(imagename);
// ImageLabel.setIcon(new ImageIcon(imagename));
String strCourse=rs.getString(16);
cbCourse.setSelectedItem(strCourse);
String strYearLevel=rs.getString(17);
cbYearLevel.setSelectedItem(strYearLevel);
ParentsContactNo.setText(rs.getString(18));
School1.setText(rs.getString(19) );
Address1.setText(rs.getString(20) );
Graduated1.setText(rs.getString(21) );
School2.setText(rs.getString(22) );
Address2.setText(rs.getString(23) );
Graduated2.setText(rs.getString(24) );
School3.setText(rs.getString(25) );
Address3.setText(rs.getString(26) );
Graduated3.setText(rs.getString(27) );
String sem=rs.getString(28);
cboSemester.setSelectedItem(sem);
String sy=rs.getString(29);
cboSY.setSelectedItem(sy);
MiddleName.setText(rs.getString(30));
String strEStatus=rs.getString(31);
cboEStatus.setSelectedItem(strEStatus);
String section=rs.getString(32);
cboSection.setSelectedItem(section);
statement.close();
connection.close();
disabled_onSearch();
}//---end of try
catch(ClassNotFoundException c)
{
System.err.println(c);
}
catch(SQLException sql)
{
JOptionPane.showMessageDialog(null,msg,"RECORD NOT FOUND?",JOptionPane.WARNING_MESSAGE);
}
}
void updateRecord()
{
try
{
Class.forName(driver);
connection=DriverManager.getConnection(url,username,password);
statement=connection.createStatement();
String citizenship=cbCitizenship.getSelectedItem().toString();
String cstatus=cbCStatus.getSelectedItem().toString();
String image=imageField.getText();
String course=cbCourse.getSelectedItem().toString();
String parentscontactno=ParentsContactNo.getText();
String yearlevel=cbYearLevel.getSelectedItem().toString();
String religion=cbReligion.getSelectedItem().toString();
String gender=cbGender.getSelectedItem().toString();
String schoo2=School2.getText();
String address2=Address2.getText();
String id=ID.getText();
String graduated2=Graduated2.getText();
String fname=FirstName.getText();
String lname=LastName.getText();
String eStatus=cboEStatus.getSelectedItem().toString();
String section=cboSection.getSelectedItem().toString();
String Semester=cboSemester.getSelectedItem().toString();
String SYear=cboSY.getSelectedItem().toString();
String sql="UPDATE StudentMaster SET FirstName='"+FirstName.getText()+"',LastName='"+LastName.getText()+"',Email='"+Email.getText()+"',Father='"+Father.getText()+"',Mother='"+Mother.getText()+"',ParentsAddress='"+ParentsAddress.getText()+"',BirthDate='"+BirthDate.getText()+"',Religion='"+religion+"',Gender='"+gender+"',ContactNo='"+Contact.getText()+"',Citizenship='"+citizenship+"',Status='"+cstatus+"',Image='"+image+"',Course='"+course+"',YearLevel='"+yearlevel+"',ParentsContactNo='"+parentscontactno+"',School1='"+School1.getText()+"',Address1='"+Address1.getText()+"',Graduated1='"+Graduated1.getText()+"',School2='"+School2.getText()+"',Address2='"+Address2.getText()+"',Graduated2='"+Graduated2.getText()+"',School3='"+School3.getText()+"',Address3='"+Address3.getText()+"',Graduated3='"+Graduated3.getText()+"',Sem='"+Semester+"',SY='"+SYear+"',MI='"+MiddleName.getText()+"',EnrollmentStatus='"+eStatus+"',Section='"+section+"' WHERE IDNumber='"+ID.getText()+"'";
statement.executeUpdate(sql);
int update = parent.database.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"Record No: "+id+"\t"+" Successfully Updated","Record Updated",JOptionPane.INFORMATION_MESSAGE);
disable_fields();
}
//studList.fillTable();
catch(ClassNotFoundException c)
{
System.err.println(c);
}
catch(SQLException sql)
{
System.err.println(sql);
}
}
void clear_fields()
{
ID.setText("");
FirstName.setText("");
FirstName.requestFocus();
LastName.setText("");
Address.setText("");
Email.setText("");
Father.setText("");
Mother.setText("");
BirthDate.setText("");
Father.setText("");
Mother.setText("");
cbGender.setSelectedItem(null);
cbCStatus.setSelectedItem(null);
cbReligion.setSelectedItem(null);
cbCitizenship.setSelectedItem(null);
cbCourse.setSelectedItem(null);
cbYearLevel.setSelectedItem(null);
cboSY.setSelectedItem(null);
cboSemester.setSelectedItem(null);
cboEStatus.setSelectedItem(null);
cboSection.setSelectedItem(null);
cboSemester.setSelectedItem(null);
cboSY.setSelectedItem(null);
Contact.setText("");
imageField.setText("");
ParentsAddress.setText("");
ParentsContactNo.setText("");
School1.setText("");
School2.setText("");
School3.setText("");
Address1.setText("");
Address2.setText("");
Address3.setText("");
Graduated1.setText("");
Graduated2.setText("");
Graduated3.setText("");
MiddleName.setText("");
// EnrollmentDate.setText("");
}
void disable_fields()
{
FirstName.setEditable(false);
LastName.setEditable(false);
Address.setEditable(false);
Email.setEditable(false);
Father.setEditable(false);
Mother.setEditable(false);
BirthDate.setEditable(false);
cbGender.setEnabled(false);
cbCStatus.setEnabled(false);
cbReligion.setEnabled(false);
cbCitizenship.setEnabled(false);
cbCourse.setEnabled(false);
cbYearLevel.setEnabled(false);
cboEStatus.setEnabled(false);
cboSection.setEnabled(false);
cboSemester.setEnabled(false);
cboSY.setEnabled(false);
Contact.setEditable(false);
imageField.setEditable(false);
School1.setEditable(false);
Address1.setEditable(false);
Graduated1.setEditable(false);
School2.setEditable(false);
Address2.setEditable(false);
Graduated2.setEditable(false);
School3.setEditable(false);
Address3.setEditable(false);
Graduated3.setEditable(false);
ParentsAddress.setEditable(false);
ParentsContactNo.setEditable(false);
MiddleName.setEditable(false);
// EnrollmentDate.setEditable(false);
}
void enable_fields()
{
FirstName.setEditable(true);
LastName.setEditable(true);
Address.setEditable(true);
Email.setEditable(true);
Father.setEditable(true);
Mother.setEditable(true);
BirthDate.setEditable(true);
cbGender.setEnabled(true);
cbCStatus.setEnabled(true);
cboEStatus.setEnabled(true);
cboSection.setEnabled(true);
cbReligion.setEnabled(true);
cbCitizenship.setEnabled(true);
cboSY.setEnabled(true);
cboSemester.setEnabled(true);
Contact.setEditable(true);
imageField.setEditable(true);
cbCourse.setEnabled(true);
cbYearLevel.setEnabled(true);
School1.setEditable(true);
Address1.setEditable(true);
Graduated1.setEditable(true);
School2.setEditable(true);
Address2.setEditable(true);
Graduated2.setEditable(true);
School3.setEditable(true);
Address3.setEditable(true);
Graduated3.setEditable(true);
ParentsAddress.setEditable(true);
ParentsContactNo.setEditable(true);
MiddleName.setEditable(true);
// EnrollmentDate.setEditable(true);
}
void onEdit()
{
FirstName.setEditable(true);
LastName.setEditable(true);
Address.setEditable(true);
Email.setEditable(true);
Father.setEditable(true);
Mother.setEditable(true);
BirthDate.setEditable(true);
cbGender.setEnabled(true);
cbCStatus.setEnabled(true);
cbReligion.setEnabled(true);
cboSection.setEnabled(true);
cboEStatus.setEnabled(true);
cbCitizenship.setEnabled(true);
cboSemester.setEnabled(true);
cboSY.setEnabled(true);
Contact.setEditable(true);
imageField.setEditable(true);
cbCourse.setEnabled(true);
cbYearLevel.setEnabled(true);
School1.setEditable(true);
Address1.setEditable(true);
Graduated1.setEditable(true);
School2.setEditable(true);
Address2.setEditable(true);
Graduated2.setEditable(true);
School3.setEditable(true);
Address3.setEditable(true);
Graduated3.setEditable(true);
MiddleName.setEditable(true);
// EnrollmentDate.setEditable(true);
ParentsAddress.setEditable(true);
ParentsContactNo.setEditable(true);
BUTTONS[5].setEnabled(true);
//BUTTONS[2].setEnabled(true);
}
void disable_OnLoad()
{
//"Add","Save","Search","Edit","Cancel","Update","Close"});
}
/* void disabled_OnAdd()
{
BUTTONS[1].setEnabled(true);
BUTTONS[2].setEnabled(false);
BUTTONS[3].setEnabled(false);
}
void enabled_OnCancel()
{
BUTTONS[5].setEnabled(false);
BUTTONS[2].setEnabled(true);
}*/
void disabled_onEdit()
{
}
void hideOnEdit()
{
}
void disabled_onSearch()
{
//BUTTONS[1].setEnabled(false);
BUTTONS[5].setEnabled(false);
BUTTONS[3].setEnabled(true);
}
boolean complete(){
boolean b = FirstName.getText().trim().length() == 0;
boolean c = LastName.getText().trim().length()==0;
boolean d = Address.getText().trim().length()==0;
boolean e = Email.getText().trim().length()==0;
boolean f = Father.getText().trim().length()==0;
boolean g = Mother.getText().trim().length()==0;
return !( b | c | d | e | f | g);
}
String clearField(String s){
if(s == null){
return "";
}
char h= ("' ").charAt(0);
String c = "";
for(int i = 0; i < s.length(); i++){
if(s.charAt(i) != h){
c = c + s.charAt(i);
}
}
return c;
}
}
View Answers
Related Tutorials/Questions & Answers:
Problem with Java Source Code - Java BeginnersProblem with
Java Source Code Dear Sir I have Following
Source Code ,But There is
Problem with classes,
plz Help Me.
package mes.gui;
import javax.swing.JOptionPane.*;
import java.sql.*;
import javax.swing.*;
import
Give me the source code for this problemGive me the
source code for this problem Ram likes skiing a lot. That's not very surprising, since skiing is really great. The
problem with skiing is one have to slide downwards to gain speed. Also when reached the bottom most
Advertisements
java source codejava source code
java source code to create mail server using struts2
request for java source coderequest for
java source code I need
source code for graphical password using cued-click points enabled with sound signature in
java and oracle 9i as soon as possible... Plz send to my mail
Java Source codeJava Source Code for text chat application using jsp and servlets
Code for text chat application using jsp and servlets
Source Code - Java BeginnersSource Code How to clear screen on command line coding like cls in DOS? Hi Friend,
Here is the
code to execute cls command of DOS through the
java file but only one restriction is that it will execute
source code of javasource code of java how to create an application using applets is front end and back end is sqlwith jdbc application is enter the student details and teaching & non teaching staff details and front end is enter in internet
source code - Java Beginnerssource code Hi...i`m new in
java..please help me to
write program that stores the following numbers in an array named price:
9.92, 6.32, 12,63... message dialog box. Hi Friend,
Try the following
code:
import
code problem - Java Beginnerscode problem Dear sir,
I'm havin a
problem that suppose i've got...
java script
j2ee
j2me
sql
plz help me to sort out this
problem.
thnx
Hi Friend,
Please try the following sample
code to solve your
problem code problem - Java Beginnerscode problem Dear sir,
my
problem is that I've a string value if this String value has "quit" then output should be "bye". i want to make this program using SWITCH CASE statement. how to implement String value in Switch plz
Problem with code - Java BeginnersProblem with code Hi Deepak. Im a newbie here at your forum. I have got a simple
code of mine which is having a little
problem. When I compile it, i get an...,identifier expected'...error. Could you help me out? Thank you
code problem - Java Beginners; Hi friend,
Code to help in solving the
problem :
import java.io....
code problem Dear Sir, I've to make a program where there are 10... in
Java visit to :
http://www.roseindia.net/
java/example/
java/io/
Thanks
code problem - Java Beginnerscode problem Dear sir,
I have an excel file in D: drive called today.xls, i want to open it thru
java program, what
code would be compatible plz help me Hi friend,
Code to help in solving the
problem :
import
code problem - Java Beginnerscode problem Dear sir,
My
problem is that i have some string value and in some case i want to remove all the value of this string, i tried this
code-
Response.str.clear();
but it shows some error called "response package
code problem - Java Beginnerscode problem Dear sir, my
problem is given below:
suppose a file Carries the following lines-
Name: john
age: 45
Address: goa
phone...; Hi friend,
Code to help in solving the
problem :
import java.io.
code problem - Java Beginnerscode problem Dear sir, my question was actually how to find a particual line's contain,
example if a file contains-
hy,
how r u?
regrd,
john... your
problem in details.
Which keyword search the line.
Thanks
code problem - Java Beginners of program.
thnx Hi friend,
Code to help in solving the
problem...
code problem Dear sir,
I've some integer value in ArrayList like-
10
40
30
i want to add them and print should be like-
"total value
code problem - Java Beginnerscode problem Dear sir,
my
problem is that, i have two Combobox
one....
plz tell how to
code this program. Hi Friend,
You can use the following
code:
ComboBox
var arr = new Array();
arr[0] = new
code problem - Java Beginnerscode problem Dear sir,
I've some string called "JohnSon" that has to be crypted first and then decrypted, how to crypt and decrypt data plz tell me. Hi friend,
Code to help in solving the
problem :
public
code problem - Java Beginnerscode problem My
code is below:
import java.io.*;
class FileRead...());
}
}
}
Dear sir,
my
problem is that suppose i enter line number: 3
if line... your
code and then again try it :
import java.io.*;
class FileRead
Java code problemJava code problem Please check the errors,if any,in this
code...i am a
java beginner
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map
code problem - Java Beginnerscode problem 1)what is accurate use of access specifiers (plz give me all uses in options)..?
2)In folllowing options which can be used... and methods.
Java provides some access modifiers like: public, private etc
code problem - Java Beginnerscode problem i've to send a login packet( username & password..., what
code should be compatible, as i heared with UDP programing there is no Guarantee of packet's delevery so send me
code made of TCP,
plz help me
Code problem - Java BeginnersCode problem Hi.
I want to create a drop down button,where the value will be hard coded and on selecting an option another drop down button... and these values will come from the database.
Can anyone help me with the
code code problem - Java Beginnerscode problem I want to write a program that read a string and prints... of space charaters
Here is the
code which I suppose is almost correct.However...;
int p,i;
boolean
q,r,t;
int count=0,count2=0,count1=0
code problem - Java Beginnerscode problem 1)what is accurate use of access specifiers (plz give me all uses in options)..?
2)In folllowing options which can be used by the inner class....?
a)private instance variables
b)public instance variables
c
code problem - Java Beginnerscode problem Dear sir,
I want to print some line with (") this sign,like:
output should come ("hello world")
instead of (hello world)
thnx hi friend,
If you want to print "hello world",you have to use
code problem - Java Beginnerscode problem Dear sir,
i'm making a program where characters of a string are being displayed having its length thru a loop, like-
s
a
t
i
s
h
i want to store them as sequence in a StringBuffer like "satish"
how
java source code - Java Beginnersjava source code I have written a
source code for recording invoices. I wish it to be evaluated. Could somebody help me with it?
Moreover, I do not know the method to attach the JAR for evaluation. My email
source code program - Java Beginnerssource code program I need the
source code for a program that converts temperatures from celsius to fahrenheit and vice versa, as well as converting kilometers to miles and vice versa using
Java "classes". Hi
Need Java Source Code - JDBCNeed
Java Source Code I have a textfield for EmployeeId in which the Id, for eg: "E001" has to be generated automatically when ever i click... be implemented. Hi friend,
Please send me
code because your posted
Java source code - Java BeginnersJava source code Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List Records. Each Record contains: Name(max 100 char), Age, Notes(No Maximum Limit). No database
Source Code cls - Java BeginnersSource Code cls Dear RoseIndia Team,
Thanks for your prompt reply to my question about alternate to cls of dos on command line
source code.
I have two submissions.
1. Instead of three lines if we simply write
Source codeSource code
source code of html to create a user login page
java source code - Java Beginnersjava source code hello Sir,
Im a beginner in java.im greatly confused, so plz send me the
source code for the following concept:
Telephone...
code:
import java.io.*;
import java.util.*;
class Directory implements
calendra.css source code - Java Beginnerscalendra.css
source code hello i need the
source code... and year are getting displayed Hi Friend,
Try the following
code...;
cursor: pointer;
}
You can also download the
code from the following link
problem in java code - Java Beginnersproblem in
java code In displaying an matrix in normal
java code we use two for loops...When i attended an interview.....the hr asked me to display the matrix by only using one loop....there should be any condition or other
source codesource code sir...i need an online shopping web application on struts and jdbc....could u pls send me the
source code source codesource code sir...i need an online shopping web application on struts and jdbc....could u pls send me the
source code jsp code problem - Java Beginnersjsp
code problem Hi,
I have a
problem with else part. It did not show the message box when the result set is null. plz, help me. thank u in advance
source codesource code hellow!i am developing a web portal in which i need to set dialy,weekly,monthly reminers so please give me
source code in jsp
source codesource code how to use nested for to print char in
java language?
Hello Friend,
Try the following
code:ADS_TO_REPLACE_1
class UseNestedLoops{
public static void main(String[] args){
char[][] letters
java Code Problem - Java Beginnersjava Code Problem Hi Sir.
i am creating one
java program in which i want to remove unsed variables from
java program and store it into another name or same name.for example,my program is as follows.
class Prog1
{
int
java - code problem - Java Beginnersjava -
code problem hi I want to create log file for my new project. so i choose logging class from util package. But here print some unwanted texts....
Other Wise send ur
code.
Thanks
java code problem - Java Beginnersjava code problem i have created a JTable in Class1 now i need to use the same JTable in another class Class2, to edit some values. i am not getting...,
Try the following
code:
1) ClassA.java
import java.io.*;
import
html code problem - Java Beginnershtml
code problem Hi,
Thank u for fast reply. In HTML form, more than one file 'action' is possible or not.
regards,
sakthi Hi friend,
In HTML in one form having One file action is possible.
Thanks