Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
KENDRIYA VIDYALAYA
NO.1
CANTT SHAHJAHANPUR
INFORMATICSPRACTICES
PROJECTWORK
2014-15
Submit t ed t o:- MISS.GAURI GUSAIN
Su...
INDEX
S .no T opic
1 Acknowledgement
2 Certificate
3 Cover P age
4 Visual M obile
oTechnology Used
5 P roject Design
6 I n...
Ima ge Pa nel
Ful l view Of Sel ect ed
Ima ge(ima gepa nel 2)
8 Code
9 DatabaseS tructure
Callregister
Contacts Table
...
CERTIFICATE
SUCCESSFULLYCOMPLETEHIS/ HERPROJECT
UNDERMYGUIDANCE.SHEHASTAKENPROPER
CAREANDSHOWNATMOSTSINCERITYIN
COMPLETION...
Acknowledgem
entI gratefully acknowledge the valuable
guidance and support given to me by my
informatics practices teacher...
VISUAL
MOBILE
INTRODUCTION
This project simulates the functionally of a
mobile set visually though java swing
programming. This project...
Project Design
This project consist of a single interface(Mobile.java) that
simulates the functionally of a mobile set us...
INTERFACE (Mobile. Java)
The Mobile. Java Interface Has Been Divided Into Two
Parts;
Upper Panel
Keypad Panel
i.e., Whe...
The upper panel itself is divided into tow parts.
Top Panel
<Function>Panel
A sample upper panel is shown below:
There a...
1.MOBILE.JAVA
(START SCREEN)
Before Listing The Code, it Is Important To Understand The
Functioning Of The Interface, whic...
CODE :
import java.sql.*;
import javax.swing.JOptionPane;
import java.text.*;
import javax.swing.ImageIcon;
public class M...
ImagesPanel2.setVisible(false);
}
//user define method
Private void action(String button)
{
int type= 0;
if(Type.getText()...
else if(type==1|| type==3)
NameTF.setText(s1+button.charAt(0));
Else
{ char ch= Charater.toLowerCase(button.charAt(0));
Na...
else if(calcPanel.isVisible())
{
if(index4 == 1)
{
if(Character.isDigit(button.charAt(2)))
{
String str= Operand1TF.getTex...
//user-defined mehod
private void viewLog()
{
try{
String name;
DateFormate
df=DateFormate.getDateInstance(DateFormate.SHO...
else
CallLogTA.append(name);
CallLogTA.append(“nt”+df.formate(rs.getDate(“Time”
))+”nn”);
i++;
if(i>=8)
break;
}
CallLogTA...
private void viewNotes()
{
try{
Class.forName(“java.sql.Driver”);
Stringdatabase=“jdbc:mysql://localhost:3306/Mobile”;
Con...
DateFormate df=
DateFormate.getDataInstance(DateFormate.SHORT);
DateTF.setText(df.format(rs.getDate(1)));
NoteTA.setText(r...
NoteTA2.setText(s1+ch);
}
}
}
//user-defined method
private void calcResult()
{ long num1=
Long.parseLong(Operand1TF.getTe...
private void C
ActionPerformed(java.awt.event.ActionEvent evt){
action(“C 1”);
}
private void E
ActionPerformed(java.awt.e...
private void I
ActionPerformed(java.awt.event.ActionEvent evt){
action(“I -”); }
private void CalcB
ActionPerformed(java.a...
private void R
ActionPerformed(java.awt.event.ActionEvent evt){
action(“R 8”); }
private void P
ActionPerformed(java.awt.e...
private void T
ActionPerformed(java.awt.event.ActionEvent evt){
action(“T ’”); }
private void W
ActionPerformed(java.awt.e...
private void A
ActionPerformed(java.awt.event.ActionEvent evt){
action(“A /”); }
private void U
ActionPerformed(java.awt.e...
ResultSet rs= stmt.executeQuery(sql2);
try{
if(rs.next())
{ name= rs.setString(1);
}
}
catch (Exception e) {
JOptionPane.s...
DialPanel2.setVisible(true);
Try
{ num= Long.parseLong(DialNumber.getText());
dial (num);
}
catch(Exception e)
{ DialNumbe...
private void Cancel
ActionPerformed(java.awt.event.ActionEvent evt)
{
MainPanel.setVisible(true);
DailPanel.setVisible(fal...
DialNumber.setText(str);
}
else if(SavePanel.isVisible())
{
String str= NameTF.getText();
str= str.subString(0, str.length...
else if(EditNotesPanel.isVisble())
{ String str= NoteTA2.getText();
NoteTA2.setText(str.substring(0,str.length()-1));
}
el...
if(icon2.isEnabled())
{ icon2.setEnabled(true);
icon3.setEnabled(false);
icon2L.setEnabled(true);
icon3L.setEnabled(false)...
SavePanel.setVisible(true);
NameTF.setText(””);
}
else if(SavePanel.isVisible())
{ String name=NameTf.getText();
String nu...
else if(MainPanel.isVisible())
{ MainPanel.setVisible(false);
ContactPanel.setVisible(true);
index=1;
search(index,’*’);
}...
else if(EditNotesPanel.isVisible())
{
try
{Class.forName(“java.sql.Driver”);
Stringdatabase=“jdbc:mysql://localhost:3306/M...
else if(ImagesPanel.isVisible())
{ ImagesPanel.setVisible(false);
ImagesPanel2.setVisible(true);
if(!icon1.isEnabled())
Im...
private void Search
ActionPerformed(java.awt.event.ActionEvent evt){
try {
Class.forName(“java.sql.Driver”);
Stringdatabas...
NameTF2.setText(rs.getString(“name”));
NumberTF2.setText(rs.getString(“number”));
}
catch(Exception e)
{NameTF2.setText(“N...
try
{num= Long.parseLong(DialNumber.getText());
dail(num); }
catch(Exception e)
{
{ DialNumber2.setText(“Invalid Number”);...
else if(NotesPanel.isVisible())
{ String text= NoteTA.getText();
String sql=“DELETE FROM Notes WHERE
Text=”’+text+”’”;
stm...
catch(Exception e){
JOptionPane.showMessageDialog(null,””+e);
}
private void Space
ActionPerformed(java.awt.event.ActionEv...
else if(Calcpanel.isVisible())
{ if (index4==1)
index4= 2;
else if (index4==2)
index4= 3;
else if (index4==3)
{ calcResult...
private void icon3
ActionPerformed(java.awt.event.ActionEvent evt)
{ImagesPanel.setVisible(false);
ImagesPanel2.setVisible...
public static void main(String args[]) {
java.awt.EventQueue.incokeLater(new Runnable()) {
public void run() {
new Mobile....
Database structure
The database used in this application is Mobile
database of MySQL. It consists of following Tables;
Tab...
1. Callregister Table
This table stores all the details of the calls made and
the time of call. Its structure is:
Field Ty...
3.Notes Table
This table stores all the details of the notes stored.
Its structure is:
Field Type Null Key Defaul
t
Extra
...
B ibliography
T ext B ook Of I nformatics
P ractices
I nternet
o http://www.cbseipprojects.in
Desktop
S mart P hone
S...
Upcoming SlideShare
Loading in …5
×

Ip project visual mobile

this projects help to understand the working of mobile phone calls :)
how call log and it's function is worked.

  • Be the first to comment

Ip project visual mobile

  1. 1. KENDRIYA VIDYALAYA NO.1 CANTT SHAHJAHANPUR INFORMATICSPRACTICES PROJECTWORK 2014-15 Submit t ed t o:- MISS.GAURI GUSAIN Submit t ed by miss:- kuma r i bha vna CLASS:- XII “COMMERCE” ROLLNO:- Pgt I.P
  2. 2. INDEX S .no T opic 1 Acknowledgement 2 Certificate 3 Cover P age 4 Visual M obile oTechnology Used 5 P roject Design 6 I nterface(M obile.java) 7 M obile.java(start S creen) Main Menu Dial Panel Dial Panel2 Save Panel ContactsPanel LogPanel Notes Panel EditnotesPanel Calculator(calcPanel)
  3. 3. Ima ge Pa nel Ful l view Of Sel ect ed Ima ge(ima gepa nel 2) 8 Code 9 DatabaseS tructure Callregister Contacts Table Notes Table
  4. 4. CERTIFICATE SUCCESSFULLYCOMPLETEHIS/ HERPROJECT UNDERMYGUIDANCE.SHEHASTAKENPROPER CAREANDSHOWNATMOSTSINCERITYIN COMPLETIONOFTHIS PROJECT. I CERTIFYTHATTHIS PROJECTIS UPTOMY EXPECTATIONANDAS PERTHELATEST GUIDELINESISSUEDBYCBSEDEHRADUN. THIS ISTOCERTIFYTHATMR./ MISS KUMARI BHAVNASTUDENT OFCLASS XII OF ...KENDRIYA..VIDYALAYA..NO.1..CANTT..S.P.N SCHOOL DATE TEACHERSIGNATURE
  5. 5. Acknowledgem entI gratefully acknowledge the valuable guidance and support given to me by my informatics practices teacher Mr./Mrs.….Gauri Gusain……in successfully completing my project report. This project gave me a clear insight into real world business situations and gave me ample opportunities to apply my theoretical knowledge to practical situations. I would also like to thank my classmates for their suggestion and support in completing this project
  6. 6. VISUAL MOBILE
  7. 7. INTRODUCTION This project simulates the functionally of a mobile set visually though java swing programming. This projects USES DATA BASE CONNECTIVITY to store call details contact details. etc. in a MySQL database. TECHNOLOGY USED Front end: Java Swing Back end: MySQL
  8. 8. Project Design This project consist of a single interface(Mobile.java) that simulates the functionally of a mobile set using many pictures and a database as evident from its Project window shown below;
  9. 9. INTERFACE (Mobile. Java) The Mobile. Java Interface Has Been Divided Into Two Parts; Upper Panel Keypad Panel i.e., Where Lower Panel Is Keypad Panel Which Is Visible All The Time. The Upper Panel Changes As Per The Function Chosen E.g., It Displays Dial Panel, save Panel, contact Panel, notes Panel, calculator Panel Etc.
  10. 10. The upper panel itself is divided into tow parts. Top Panel <Function>Panel A sample upper panel is shown below: There are various function panels e.g., Dial panel, Save panel, Calculator panel, notes panel etc. in the projects that have been stored inside TopPanel and these lie over one another with the help of cardLayout.
  11. 11. 1.MOBILE.JAVA (START SCREEN) Before Listing The Code, it Is Important To Understand The Functioning Of The Interface, which Is Being Explained Below With The Help Of Screen Shots.
  12. 12. CODE : import java.sql.*; import javax.swing.JOptionPane; import java.text.*; import javax.swing.ImageIcon; public class Mobile extends javax.swing.JFrame { //Global Variables int index = 1; //for iterating through contacts int index2 = 1; //for iterationg through notes int index3 = 1; //for adding new notes int index4 = 1; //for calculator /**Constructor*/ public Mobile() { initcomponents(); MainPanel.setVisible(true); DailPanel.setVisible(false); DailPanel.setVisible(false); SavePanel.setVisible(false); ContactPanel.setVisible(false); LogPanel.setVisible(false); NotesPanel.setVisible(false); EditNotesPanel.setVisible(false); CalcPanel.setVisible(false);
  13. 13. ImagesPanel2.setVisible(false); } //user define method Private void action(String button) { int type= 0; if(Type.getText().equals(“123…”)) type=1; else if(Type.getText().equals(“abc…”)) type=2; else if(Type.getText().equals(“ABC…”)) type=3; if (MainPanel.isVisible()) { MainPanel.setVisible(false); DailPanel.setVisible(true); DialNumber.setText(button.charAt(2)+””); } else if(SavePanel.isVisible()) { String s1= NameTF.getText(); if (s1.equals(“”)) NameTF.setText(button.charAt(0));
  14. 14. else if(type==1|| type==3) NameTF.setText(s1+button.charAt(0)); Else { char ch= Charater.toLowerCase(button.charAt(0)); NameTF.setText(s1+ch); } } else if(DailPanel.isVisible()) { DialNumber.setText(DialNumber.getText()+button.ch arAt(2)); } else if(ContactPanel.isVisible()) { NumberTF2.setText(“”); index=1; search(index,button.charAt(0)); } else if(EditNoteSPanel.isVisible()) { addNote(button,type); }
  15. 15. else if(calcPanel.isVisible()) { if(index4 == 1) { if(Character.isDigit(button.charAt(2))) { String str= Operand1TF.getText(); Operand1TF.setText(str+button.charAt(2)); } } else if(index4 == 3) if(Character.isDigit(button.charAt(2))) { String str= Operand2TF.getText(); Operand2TF.setText(str+button.charAt(2)); } } else if(index4 == 2) { char ch=button.charAt(2); if(ch ==‘+’||ch==‘-’||ch==‘*’||ch==‘/’) { OperatorTF.setText(ch+””); } } } }
  16. 16. //user-defined mehod private void viewLog() { try{ String name; DateFormate df=DateFormate.getDateInstance(DateFormate.SHOR T); Class.forName(“java.sql.Driver”); String database=“jdbc:mysql://localhost:3306/Mobile”; connection conn= DriverManager.getConnection(database,”root”,”wxyz ”); Statement stmt=conn.createStatement(); String sql2=“SELECT * FROM CallRegister oder by Time desc”; ResultSet rs= stmt.executeQuery(sql2); int i=0; CallLogTA.setText(“”); while(rs.next()) { name = rs.getString(“name”); if(name.equals(“null”)) CallLogTA.append(rs.getString(“number”));
  17. 17. else CallLogTA.append(name); CallLogTA.append(“nt”+df.formate(rs.getDate(“Time” ))+”nn”); i++; if(i>=8) break; } CallLogTA.setCarePosition(0); rs.close(); Stmt.close(); conn.close(); } catch(Exception e){CallLogTA.setText(“No entery found”); JOptionPane.showMessageDialog(null,””+e);} } //user-defined method
  18. 18. private void viewNotes() { try{ Class.forName(“java.sql.Driver”); Stringdatabase=“jdbc:mysql://localhost:3306/Mobile”; Connection conn=DriverManager.getConnection(database,”root”, ”wxyz”); Statement stmt= conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); String sql=“SELECT * FROM Notes order by date”; ResultSet rs = stmt.executeQuery(sql); for(int i =0;i<index2;i++) { if(rs.isLast()) { rs.first(); } Else rs.next(); } DateFormate df= DateFormate.getDataInstance(DateFormate.SHORT)
  19. 19. DateFormate df= DateFormate.getDataInstance(DateFormate.SHORT); DateTF.setText(df.format(rs.getDate(1))); NoteTA.setText(rs.getString(2)); rs.close(); Stmt.close(); conn.close(); } catch(Exception e){ NoteTA.setText(“empty”); JOptionPane.showMessageDialog(null,””+e); } } //user-defined method private void addNote(String button,int type) { if(index==1) { DateTF2.append(button.char(2)+””); } Else{ String s1=NoteTA2.getText(); if (type==1) NoteTA.setText(s1+button.charAt(2)); else if(type == 3) NoteTA.setText(s1+button.charAt(0)); else { char ch= Character.tolowercase(button. char(0));
  20. 20. NoteTA2.setText(s1+ch); } } } //user-defined method private void calcResult() { long num1= Long.parseLong(Operand1TF.getText()); char op= OperatorTF.getText()charAt(0); long num2= Long.parseLong(Operand2TF.getText()); long Result=0; switch(op) { case’+’: Result= num1+num2; break; case’-’: Result= num1-num2; break; case’*’: Result= num1*num2; break; case’/’: Result= num1/num2; break; default: ResultTF.setText(“Invalid Options”); } ResultTF.setText(Result+””); } private void B ActionPerformed(java.awt.event.ActionEvent evt){ action(“B+”); }
  21. 21. private void C ActionPerformed(java.awt.event.ActionEvent evt){ action(“C 1”); } private void E ActionPerformed(java.awt.event.ActionEvent evt){ action(“E 3”); } private void H ActionPerformed(java.awt.event.ActionEvent evt){ action(“H -”); } private void F ActionPerformed(java.awt.event.ActionEvent evt){ action(“F(”); } private void D ActionPerformed(java.awt.event.ActionEvent evt){ action(“D 2”); } private void k ActionPerformed(java.awt.event.ActionEvent evt){ action(“K 5”); } private void J ActionPerformed(java.awt.event.ActionEvent evt){ action(“J 4”); }
  22. 22. private void I ActionPerformed(java.awt.event.ActionEvent evt){ action(“I -”); } private void CalcB ActionPerformed(java.awt.event.ActionEvent evt){ MainPanel.setVisible(false); CalcPanel.setVisible(true); index4=1; OperandTF.setText(“”); OperaterTF.setText(“”); Operand2TF.setText(“”); ResultTF.setText(“”); } private void L ActionPerformed(java.awt.event.ActionEvent evt){ action(“L 6”); } private void M ActionPerformed(java.awt.event.ActionEvent evt){ action(“M :”); } private void N ActionPerformed(java.awt.event.ActionEvent evt){ action(“N ;”); } private void S ActionPerformed(java.awt.event.ActionEvent evt){ action(“S 9”); }
  23. 23. private void R ActionPerformed(java.awt.event.ActionEvent evt){ action(“R 8”); } private void P ActionPerformed(java.awt.event.ActionEvent evt){ action(“P *”); } private void $ ActionPerformed(java.awt.event.ActionEvent evt){ action(“# &”); } private void V ActionPerformed(java.awt.event.ActionEvent evt){ action(“V =”); } private void O ActionPerformed(java.awt.event.ActionEvent evt){ action(“O @”); } private void Q ActionPerformed(java.awt.event.ActionEvent evt) {action(“Q 7”); } private void X ActionPerformed(java.awt.event.ActionEvent evt){ action(“X 0”); } private void G ActionPerformed(java.awt.event.ActionEvent evt){ action(“G )”); }
  24. 24. private void T ActionPerformed(java.awt.event.ActionEvent evt){ action(“T ’”); } private void W ActionPerformed(java.awt.event.ActionEvent evt){ action(“W $”); } private void Shift ActionPerformed(java.awt.event.ActionEvent evt){ if (Type.getText().equals(“123…….”)) { Type.setText(“abc.......”);} else if (Type.getText().equals(“abc…….”)) { Type.setText(“ABC.......”);} else { Type.setText(“123.......”);} } private void Y ActionPerformed(java.awt.event.ActionEvent evt){ action(“Y %”); } private void Z ActionPerformed(java.awt.event.ActionEvent evt){ action(“Z ?”); } private void _ ActionPerformed(java.awt.event.ActionEvent evt){ action(“, .”); }
  25. 25. private void A ActionPerformed(java.awt.event.ActionEvent evt){ action(“A /”); } private void U ActionPerformed(java.awt.event.ActionEvent evt){ action(“U ”); } // user-defined method private void dail(long num) { string name= null; java.until.Date d= new.java.until.Date(); DateFormate df=DateFormate.getDateInstance(DateFormate.SHOR T); try{ Class.forName(“java.sql.Drive”); String database=“jdbc:mysql;//localhost:3306/Mobile”; Connection conn=DriverManager.getConnection(database, “root, “wxyz”); Statement stmt= conn.createStatement(); String sql2=“SELECT name FROM Contacts WHERE number= “+ num;
  26. 26. ResultSet rs= stmt.executeQuery(sql2); try{ if(rs.next()) { name= rs.setString(1); } } catch (Exception e) { JOptionPane.showMessageDialog(null,””+e);} String sql= “INSERT INTO CallRegister VALUES(’ ”+ ‘ “,”+num+”, ’ ”+df.formate(d)+ “’)”; stmt.executeUpdate(sql); Dialnumber2.setText(“calling….n”+num); stmt.close(); conn.close(); } catch(Exeception e) { DialNumber2.setText(“Invalid Number”); JOptionPane.showMessageDialog(null,””+e); } } private void Dail ActionPerformed(java.awt.event.ActionEvent evt){ if(DialPanel.isVisible()) { Dailpanel.setVisible(false); long num= 0;
  27. 27. DialPanel2.setVisible(true); Try { num= Long.parseLong(DialNumber.getText()); dial (num); } catch(Exception e) { DialNumber2.setText(“Invalid Number”); JOptionPane.showMessageDialog(null, “”+e); } } else if (ContactPanel.isVisible()) { ContactPanel.setVisible(false); DialPanel2.setVisible(true); try { long num= 0; num= Long.parseLong(NumberTF2.getText()); dail(num); } catch(Exception e) { { DialNumber2.setText(“Invalid Number”); JOptionPane.showMessageDialog(null, “”+e); } } }
  28. 28. private void Cancel ActionPerformed(java.awt.event.ActionEvent evt) { MainPanel.setVisible(true); DailPanel.setVisible(false); DailPanel2.setVisible(false); SavePanel.setVisible(false); ContactPanel.setVisible(false); LogPanel.setVisible(false); NotesPanel.setVisible(false); EditNotesPanel.setVisible(false); CalcPanel.setVisible(false); ImagesPanel.setVisible(false); ImagesPanel2.setVisible(false); } private void Right ActionPerformed(java.awt.event.ActionEvent evt){ if(MainPanel.isVisible()) { MainPanel.setVisible(false); viewLog(); LogPanel.setVisible(true);} else if(DailPanel.isVisible()) { String str= DailNumber.getText(); str= str.substring(0,str.length()-1);
  29. 29. DialNumber.setText(str); } else if(SavePanel.isVisible()) { String str= NameTF.getText(); str= str.subString(0, str.length()-1); NameTF.setText(str); } else if(ContactPanel.isVisible()) { index++; search(index,’*’); } else if(LogPanel.isVisible()) { LogPanel.setVisble(false); index2 = 1; viewNotes(); NotesPanel.setVisible(true); } else if(NotesPanel.isVisible()) { index++; viewNotes(); }
  30. 30. else if(EditNotesPanel.isVisble()) { String str= NoteTA2.getText(); NoteTA2.setText(str.substring(0,str.length()-1)); } else if(Calcpanel.isVisible()) { String str; if(index4 == 1) { str= OperandTF.getText(); OperandTF.setText(str.substring(0,str.length()-1)); } if(index4 == 2) { str= Operand2TF.getText(); Operand2TF.setText(str.substring(0,str.length()-1)); } } else if(ImagesPanel.isVisible()) { if(icon1.isEnabled()) { icon1.setEnabled(true); icon2.setEnabled(false); icon1L.setEnabled(true); icon2L.setEnabled(false); }
  31. 31. if(icon2.isEnabled()) { icon2.setEnabled(true); icon3.setEnabled(false); icon2L.setEnabled(true); icon3L.setEnabled(false); } if(icon3.isEnabled()) { icon3.setEnabled(true); icon4.setEnabled(false); icon3L.setEnabled(true); icon4L.setEnabled(false); } if(icon4.isEnabled()) { icon4.setEnabled(true); icon1.setEnabled(false); icon4L.setEnabled(true); icon1L.setEnabled(false); } } } private void OK ActionPerformed(java.awt.event.ActionEvent evt){ if(DailPanel.isVisible()) { String n = DailNumber.getNumber(); NumberTF.setText(n); DailPanel.setVisible(false);
  32. 32. SavePanel.setVisible(true); NameTF.setText(””); } else if(SavePanel.isVisible()) { String name=NameTf.getText(); String num= NumberTF.getText(): try { Class.forName(“java.sql.Driver”); Stringdatabase=“jdbc:mysql://localhost:3306/Mobile”; Connection conn=DriverManager.getConnection(database,”root”, ”wxyz”); Statement stmt= conn.createStatement(); String sql=“INSERT INTO Contacts VALUES(’”+name+”’,”+num+”)”; stmt.executeUpdate(sql); SavePanel.setVisible(false); MainPanel.setVisible(true); stmt.close(); conn.close(); } catch(Exception e){ JOptionPane.showMessageDialog(null,””+e); } }
  33. 33. else if(MainPanel.isVisible()) { MainPanel.setVisible(false); ContactPanel.setVisible(true); index=1; search(index,’*’); } else if(ContactPanel.isVisible()) { ContactPanel.setVisible(false); DailPanel2.setVisible(true); try { long num=0; num= Long.parseLong(NumberTF2.getText()); dial(num); } catch(Exception e) { DailNumber2.setText(“Invalid Number”) JOptionPane.showMessageDialog(n ull,””+e); } } else if(NotesPanel.isVisible()) {NotesPanel.setVisible(false); EditNotesPanel.setVisible(true); }
  34. 34. else if(EditNotesPanel.isVisible()) { try {Class.forName(“java.sql.Driver”); Stringdatabase=“jdbc:mysql://localhost:3306/Mobile”; Connection conn=DriverManager.getConnection(database,”root”, ”wxyz”); Statement stmt= conn.createStatement(); String sql=“INSERT INTO Notes VALUES(’”+DateTF.getText()+”’,”+NotesTF.getText()+”)” ; stmt.executeUpdate(sql); EditNotesPanel.setVisible(false); MainPanel.setVisible(true); stmt.close(); conn.close(); } catch(Exception e){ JOptionPane.showMessageDialog(null,””+e); } } else if(Calcpanel.isVisible()) { calcResult(); index4= 1; }
  35. 35. else if(ImagesPanel.isVisible()) { ImagesPanel.setVisible(false); ImagesPanel2.setVisible(true); if(!icon1.isEnabled()) ImgL.setIcon(new ImagesIcon(“scrImage1.jpg)); else if(!icon2.isEnabled()) ImgL.setIcon(new ImagesIcon(“scrImage2.jpg)); else if(!icon3.isEnabled()) ImgL.setIcon(new ImagesIcon(“scrImage3.jpg)); else if(!icon4.isEnabled()) ImgL.setIcon(new ImagesIcon(“scrImage4.jpg)); } } //user-defined method
  36. 36. private void Search ActionPerformed(java.awt.event.ActionEvent evt){ try { Class.forName(“java.sql.Driver”); Stringdatabase=“jdbc:mysql://localhost:3306/Mobile”; Connection conn=DriverManager.getConnection(database,”root”, ”wxyz”); Statement stmt= conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); String sql=“SELECT * FROM Contacts”; if(option!=‘*’) Sql+=“WHERE name like’”+option+”%’” sql+=“order by name”; ResultSet rs = stmt.executeQuery(sql); for(int i =0;i<n;i++) { if(rs.isLast()) { rs.first(); } else rs.next(); }
  37. 37. NameTF2.setText(rs.getString(“name”)); NumberTF2.setText(rs.getString(“number”)); } catch(Exception e) {NameTF2.setText(“Not found”); JOptionPane.showMessageDialog(null,””+e); } } private void Left ActionPerformed(java.awt.event.ActionEvent evt){ try { Class.forName(“java.sql.Driver”); Stringdatabase=“jdbc:mysql://localhost:3306/Mobile”; Connection conn=DriverManager.getConnection(database,”root”, ”wxyz”); Statement stmt= conn.createStatement(); if(MainPanel.isVisible()) {MainPanel.setVisible(false); ImagesPanel.setVisible(true); } else if(DialPanel.isVisible()) {DailPanel.setVisible(false); long num= 0; DailPanel.setVisible(true);
  38. 38. try {num= Long.parseLong(DialNumber.getText()); dail(num); } catch(Exception e) { { DialNumber2.setText(“Invalid Number”); JOptionPane.showMessageDialog(null, “”+e); } } else if(ContactPanel.isVisible()) { String name=NameTF2.getText(); int num=Integer.parseInt(NumberTF2.getText()); String sql=“DELETE FROM Contacts WHERE name=+”’AND number=”+num; stmt.executeUpdate(sql); MainPanel.setVisible(true); ContactPanel.setVisible(false); } else if(SavePanel.isVisible()) { MainPanel.setVisible(true); SavePanel.setVisible(false); } else if(LogPanel.isVisible()) { String sql=“delete FROM CallRegister”; stmt.executeUpdate(sql); { LogPanel.setVisible(false); MainPanel.setVisible(true); }
  39. 39. else if(NotesPanel.isVisible()) { String text= NoteTA.getText(); String sql=“DELETE FROM Notes WHERE Text=”’+text+”’”; stmt.executeUpdate(sql); index2=1; viweNotes(); } else if(EditNotesPanel.isVisible()) { index3=1; } else if(Calcpanel.isVisible()) { index4= 1; Operand1TF.setText(“”); OperaterTF.setText(“”); Operand2TF.setText(“”); ResultTF.setText(“”); } else if(ImagesPanel.isVisible()) { ImagesPanel.setVisible(false); MainPanel.setVisible(true); } else if(ImagesPane2.isVisible()) {ImagesPane2.setVisible(false); ImagesPanel1.setVisible(true); } stmt.close(); conn.close(); }
  40. 40. catch(Exception e){ JOptionPane.showMessageDialog(null,””+e); } private void Space ActionPerformed(java.awt.event.ActionEvent evt){ action(“ “); } private void LogB ActionPerformed(java.awt.event.ActionEvent evt) {MainPanel.setVisible(false); viewLog(); LogPanel.setVisible(true); } private void NotesB ActionPerformed(java.awt.event.ActionEvent evt) {MainPanel.setVisible(false); NotesPanel.setVisible(true); index2= 1; viewNotes(); } private void Enter ActionPerformed(java.awt.event.ActionEvent evt) { try { if(EditNotesPanel.isVisible()&& index3==1) { index3=2; Type.setText(“ABC…”) }
  41. 41. else if(Calcpanel.isVisible()) { if (index4==1) index4= 2; else if (index4==2) index4= 3; else if (index4==3) { calcResult(); index4= 1; } } else action(“nn”); } catch(Exception e){ JOptionPane.showMessageDialog(null,””+e); } private void icon1 ActionPerformed(java.awt.event.ActionEvent evt) {ImagesPanel.setVisible(false); ImagesPanel2.setVisible(true); ImgL.setIcon(new ImagesIcon(“scrImage1.jpg));
  42. 42. private void icon3 ActionPerformed(java.awt.event.ActionEvent evt) {ImagesPanel.setVisible(false); ImagesPanel2.setVisible(true); ImgL.setIcon(new ImagesIcon(“scrImage3.jpg)); } private void icon2 ActionPerformed(java.awt.event.ActionEvent evt) {ImagesPanel.setVisible(false); ImagesPanel2.setVisible(true); ImgL.setIcon(new ImagesIcon(“scrImage2.jpg)); } private void FilesB ActionPerformed(java.awt.event.ActionEvent evt) {MainPanel.setVisible(false); icon1.setSelected(true); ImagesPanel.setVisible(true); } private void icon 4 ActionPerformed(java.awt.event.ActionEvent evt) {ImagesPanel.setVisible(false); ImagesPanel2.setVisible(true); ImgL.setIcon(new ImagesIcon(“scrImage4.jpg)); }
  43. 43. public static void main(String args[]) { java.awt.EventQueue.incokeLater(new Runnable()) { public void run() { new Mobile.setVisible(true); } }); }
  44. 44. Database structure The database used in this application is Mobile database of MySQL. It consists of following Tables; Tables_in_mobile callregister contacts notes
  45. 45. 1. Callregister Table This table stores all the details of the calls made and the time of call. Its structure is: Field Type Null Key Default Extra Name varchar (20) YES NULL Number varchar (20) YES NULL Time date YES NULL 2. Contacts Table This table stores all the details of the contacts stored. Its structure is: Field Type Null Key Default Extra Name varchar (20) YES NULL Number bigint (20) NO PRI NULL
  46. 46. 3.Notes Table This table stores all the details of the notes stored. Its structure is: Field Type Null Key Defaul t Extra date date YES NULL text varchar (200) YES NULL
  47. 47. B ibliography T ext B ook Of I nformatics P ractices I nternet o http://www.cbseipprojects.in Desktop S mart P hone S oftware's  Mysql  NetBeans IDE 6.0 M y I .P T eacher  Miss Gauri Mam

×