SlideShare a Scribd company logo
1 of 47
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
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)
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
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
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
VISUAL
MOBILE
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
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;
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.
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.
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.
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);
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));
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);
}
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+””); } } }
}
//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”));
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
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)
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));
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+”);
}
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”); }
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”); }
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 )”); }
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(“, .”); }
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;
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;
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);
}
} }
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);
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();
}
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);
}
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);
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); }
}
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);
}
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;
}
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
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(); }
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);
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);
}
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(); }
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…”) }
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));
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));
}
public static void main(String args[]) {
java.awt.EventQueue.incokeLater(new Runnable()) {
public void run() {
new Mobile.setVisible(true);
}
});
}
Database structure
The database used in this application is Mobile
database of MySQL. It consists of following Tables;
Tables_in_mobile
callregister
contacts
notes
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
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
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

More Related Content

What's hot

Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
Rajeev Sharan
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
Swarup Kumar Boro
 

What's hot (20)

Java
JavaJava
Java
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
Java File
Java FileJava File
Java File
 
MaintainStaffTable
MaintainStaffTableMaintainStaffTable
MaintainStaffTable
 
Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*
 
Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
 
clean code book summary - uncle bob - English version
clean code book summary - uncle bob - English versionclean code book summary - uncle bob - English version
clean code book summary - uncle bob - English version
 
C programming
C programmingC programming
C programming
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing
 
Clean code
Clean codeClean code
Clean code
 
Clean code
Clean codeClean code
Clean code
 
Informatics Practices Project on Tour and travels
 Informatics Practices Project on Tour and travels  Informatics Practices Project on Tour and travels
Informatics Practices Project on Tour and travels
 
Clean code
Clean codeClean code
Clean code
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diploma
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
Indexing thousands of writes per second with redis
Indexing thousands of writes per second with redisIndexing thousands of writes per second with redis
Indexing thousands of writes per second with redis
 
Compiler
CompilerCompiler
Compiler
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 
Clean Code: Chapter 3 Function
Clean Code: Chapter 3 FunctionClean Code: Chapter 3 Function
Clean Code: Chapter 3 Function
 

Viewers also liked (6)

Best Way to Write SQL in Java
Best Way to Write SQL in JavaBest Way to Write SQL in Java
Best Way to Write SQL in Java
 
Modul Kelas Programming : Java MySQL
Modul Kelas Programming : Java MySQLModul Kelas Programming : Java MySQL
Modul Kelas Programming : Java MySQL
 
informatics practices practical file
informatics practices practical fileinformatics practices practical file
informatics practices practical file
 
PPT FOR ONLINE HOTEL MANAGEMENT
PPT FOR ONLINE HOTEL MANAGEMENTPPT FOR ONLINE HOTEL MANAGEMENT
PPT FOR ONLINE HOTEL MANAGEMENT
 
Investigatory Project
Investigatory ProjectInvestigatory Project
Investigatory Project
 
Tic tac toe c++ project presentation
Tic tac toe c++ project presentationTic tac toe c++ project presentation
Tic tac toe c++ project presentation
 

Similar to Ip project visual mobile

Unit 3(rdbms)
Unit 3(rdbms)Unit 3(rdbms)
Unit 3(rdbms)
Jay Patel
 
Unit 3(rdbms)
Unit 3(rdbms)Unit 3(rdbms)
Unit 3(rdbms)
Jay Patel
 
Your codebase sucks! and how to fix it
Your codebase sucks! and how to fix itYour codebase sucks! and how to fix it
Your codebase sucks! and how to fix it
Llewellyn Falco
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android Development
Jussi Pohjolainen
 

Similar to Ip project visual mobile (20)

Fundamental of programming - مقدمات برنامه نویسی
Fundamental of programming - مقدمات برنامه نویسیFundamental of programming - مقدمات برنامه نویسی
Fundamental of programming - مقدمات برنامه نویسی
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Unit 3(rdbms)
Unit 3(rdbms)Unit 3(rdbms)
Unit 3(rdbms)
 
Unit 3(rdbms)
Unit 3(rdbms)Unit 3(rdbms)
Unit 3(rdbms)
 
The Ring programming language version 1.10 book - Part 95 of 212
The Ring programming language version 1.10 book - Part 95 of 212The Ring programming language version 1.10 book - Part 95 of 212
The Ring programming language version 1.10 book - Part 95 of 212
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
 
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
 
Unit 3
Unit 3Unit 3
Unit 3
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
 
Lecture 09 high level language
Lecture 09 high level languageLecture 09 high level language
Lecture 09 high level language
 
How to write automated tests and don’t lose your mind by Dorian Sarnowski Scalac
How to write automated tests and don’t lose your mind by Dorian Sarnowski ScalacHow to write automated tests and don’t lose your mind by Dorian Sarnowski Scalac
How to write automated tests and don’t lose your mind by Dorian Sarnowski Scalac
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
 
Your codebase sucks! and how to fix it
Your codebase sucks! and how to fix itYour codebase sucks! and how to fix it
Your codebase sucks! and how to fix it
 
Android tutorial (2)
Android tutorial (2)Android tutorial (2)
Android tutorial (2)
 
Refactoring & Restructuring - Improving the Code and Structure of Software
Refactoring & Restructuring - Improving the Code and Structure of SoftwareRefactoring & Restructuring - Improving the Code and Structure of Software
Refactoring & Restructuring - Improving the Code and Structure of Software
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android Development
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189
 
20230721_OKC_Meetup_MuleSoft.pptx
20230721_OKC_Meetup_MuleSoft.pptx20230721_OKC_Meetup_MuleSoft.pptx
20230721_OKC_Meetup_MuleSoft.pptx
 

Recently uploaded

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 

Recently uploaded (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

Ip project visual mobile

  • 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. 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. 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. 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. 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
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. //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”));
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. public static void main(String args[]) { java.awt.EventQueue.incokeLater(new Runnable()) { public void run() { new Mobile.setVisible(true); } }); }
  • 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. 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. 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. 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