Ajp Manual
Ajp Manual
are used to
1. Practical Significance: MouseMotionListener interfaceis clicked,
The MouseListener and are created when the
mouse implementdropped.the
dragged,
that
different types of events a component. and perform
some
action in that
released, entered and exited inUser to handlethe events
the
These two Interfaces lets
event.
Outcome(s)
VI. Relevant Affective domain related
measures.
1. Follow precautionary
2. Follow naming conventions.
3. Follow ethical practices.
60
Maharashtra state Board of Technical Education
AdvancedJava Programming (22517)
to
Obtoin the coodinoteç of mouge click 8
O Tmplement MoUse
(1eote
ListeneY i
Oclos thot imple nents NOU6eliston e ,
oUeide mousecliCked ethod
IrGide this method
you con get the coordinoteg
Get co0Tdinotes;
Use qet x() getu) fiom the mouGeCuont pO10metey
aAddliGtere
(iSteney
c100t
Instontiate o0 l;stener Clo 5.
Pegistey the Listeney -
OSe the addm oUSe ListoneYC or MOUS eNotion
P2
AdvancedJava Programmning (2251 7)
XII. Exercise
Write a program to change the background color of Applet when User performs
events using Mouse
2. Write a program to count the number of clicks performned by the user in a Frame
window
1 Write a program to demonstrate the use of mouseDragged and mouseMoved
method of MouseMotionListener
(Space for answer)
Public boidinitl )
ePoint(0j
61
Maharashtra state Board of Technical Education
Programming(225 17)
Advanced Java i60cntered CHouS
m ou6
PubliC woid mouG eCxitedC
PUbiC .* * * * *
Reading
Further
Suggestions for
1. https://www.javatpoint.com/java-mouselistener
References/ Herbert Schildt
XIV,
complete reference Java 2 by
2. The
Assessment Scheme
XV, Performance Indicators Weightage
70%
Marks)
Process related (35 30%
Logic formation 30%
Debugging ability 10%
2.
Follow ethical practices
30%
3. Marks)
Product related (15
10%
Expected output 10%
4.
Timely Submission
5. 10%
questions
6. Answer to sample 100%
Total(50 Marks)
Team Members
List ofStudents /
1.
2.
3.
Dated signature of
Marks Obtained Teacher
setrile("click counten))nedoh
setGi2eC3oo20)3
set OetoukClos eoperotion( @x\r- oN-CIOs)3
lobel. setText(click.ttCoUnt)yio8
s loo
3
public ooid m0use PiessedCouse Euente o
publiC o0id mouse leosed CHoU6e Cuont e)
pu blic 00id mouselxi(ed CHogGe Cuent )
publiC soid mouse fn teredcMouse uont )
ui5i61eCtiUe))
new CUcKCOGntoyC0. 6 et
gmpork åou0x-6oinoj Advan
inpor tiov-0wt-euent.
OUGeNo tiGh GxOmple extend
Ady public cass
NOUSeNotion listener 1.
Education
Maharashtra state Board of Technical
Advanced.Java Programning (2251 7)
VI.
Relevant Affective domain related Outcome(s)
1. Follow precautionary measures.
2. Follow naming conventions.
3. Follow ethical practices.
fnter passcoOTg!
i5 USed
*******s*******
2) Aduontages
Input Hondlin q
3Cho 10c tey contyol
DefauiE Behavio
input Paom
accept
applicotion
**********
o Jaua ..............
J1ext Aipd
XIII. Exercise
to demonstrate the use of nser
1. Write a program using JPasswordField and JTextField
authentication
the addition of two numbers.
2. Write a program using JTextField to perform if the length is
3. Write a program using JPasswordField to accept password from user and length must ba
less than6 characters then error message should be displayed *Password
>6 characters"
(Space for Answer)
J i m port i ovay-Swing.
PUblic CO55 Vse YAuth
****
***
******ks.
pOssield :ne
********se
s******
*****
2
program statement to group of
assign a separate
X. Program Code: Teacher must
3-4 students.
catch(Exception e) {System.out.println(e):}
Ip ddd1099: 127.0o1
76
Maharashtra state Board of Technical Education
AdvancedJava Programming
(22517)
,oe***** length
**********
32 bit6(4 byteg)
*e*******.**
(0Forma! 12g bít( IG by(es )
*****
space
0ecimol Hexod ecim al
(onfigU1ation
4-3 *******
bi|i0n
340
***
5ecuiy
Honual ov DH(P stoteloss oto (ontigu sotioh
A C109enotion IPsec optionol ID sec mondatny
Rouler5 con Bog menl e*****ecsbsee
only soUTCe
1tOD6 tho
(ontoing (ocallat zp inston(
Inet Ades6 ******.**
A aet AW Nome
Bynome- 0etemine
host giuen the host's a l the CP addye55
Public clas6
11*vk*****************
ain(skiing) angg
public 6tdtic uoid n
5ting host J
(sys(em.in);
SCanneY. inpUt = n 5connPr
6y5em-out PintlhlCntpr host
........
********
6yotem. out.pin Hn(could not nohojk)
PracticalSignificance:
The Uniform resource locator in java allows the user to access the particular file or
resource which might be stored on any local or remote machine. The URL specifies
the complete path by which user can access file. It contains protocol address, port
humber and location of the particular resource.
Relevant
Basic Program
knowledge:Outcomes
Apply (POs)
knowledge of basic mathematics, sciences and basic
engincering to solve the computer group related problems.
Computer Programming knowledge to solve
Discipline knowledge: Apply
computer group related problems. practices to use th.
Experiments and practice: Plan to perform experiments and
results to solve the computer group related problems. / technologies and
e
Engineering tools: Apply relevant Computer programming
tools with an understanding of the limitations.
and team member in
" Individual and Team work: Function effectively as a leader
diverse/multidisciplinary teams.
Communication: Communicate effectively in oral and written form.
III, Competency and Practical skills
To develop a program using URL and URLConnection class
The practical is expected to develop the following skills:
1. Able to identify different types of ports and protocols
class.
2. Able todevelop an application using URL and URLConnection
IV. Relevant Course Outcome(s)
Develop java programs using networking components
V Practical Outcome (PrOs)
class and its
Write a program to demonstrate the use of URL and URLConnection
methods
VI. Relevant Affective domain related Outcome(s)
1. Follow precautionary measures.
2. Follow naming conventions.
3. Follow ethical practices.
VIL. Minimum Theoretical Background
The URIL provides easy to understand format to uniquely identify or address
information on the intemet. URLs are ample; every browser uses them to identify
information on the Web. URL class provides a simple, concise API to access
information across the Internet using URLs.
URLConnection is a class which is used to access the attributes of remote resource.
Once we made a connection to the remote resource, we are ready to use
URLConnection to check the properties of remote object before actually transporting
it locally.
open(onrectionl) method
J S The speciied oRL and
OpehG he (onnpctioh
thot 1epe sen t a
URL cohneCtion insto nce
1emote objects
(orneCtion to th e
*********.
bu the URL
reCt
be no ted (-hot a ORC Coh
******************.
- T hould
GY nstonce does ngt: e5 toblig h
....***.*....*
(he actu
o n the (Yeotign
2 j O v d -net.uRl
3 ) a l PomnedorlCx(eplion
Exercise
1. Write a program using URL class to retrieve the host. protocol. port and file of
URL http://www.msbte.org in
Write a
2. program using URI and
content type, content length URLConnection
information of any
class to retrieve the date.
(Space for Answer) entered URL
)fropovt -)aa-nel
Public
s*****
\a66 ORL.
publiC sto tiC
*******.
Demo
u0id moin
publiC 3Molto\od URLEyceptio (6tsing-0195 )
Atem.00t.Pintlh( p3otorol
******
t dg e
Iriedt)j
tem-0ut. pint)nC i Pont U-getpot (3) 1
S46tem- oat- prin }l h( tugeHilec);
U-get2e1))3
AuGtem-0ut. pTntnCEyiF +Uto f tenctionl)3
Public Static
int chj
ORL phaso. cove)
e
ConneCtIoh hondi@-(onvoction handle
Gpen (onnection traa dote inoj
int le ng th
clato,i
no-handle-comnenctioh got Dota;
Su5tem-0ut- Println(patthew oatecode ,i04
AuAtem.out Pint\nCCantexk typeihand Ie
ConnCtion get
leng th length
-Connection.getrontextlenglhl)y
Suslerm-oUt-rintlhCcon texk length:' lenyth))
Adanced Java
Programming (2251 7)
1
V.
Practical Outcome (PrOs)
Write a program toinsert and retrieve data from database using JDBC
VI. Relevant Affective domain related Outcome(s)
1. Follow precautionary measures.
2. Follow naming conventions.
3. Follow ethical practices.
VIL. Minimum Theoretical Background
JDBC APl enables the application to interact with the different types of databases.
It is possible to publish vital information from a remote database on a webpage using the Java
applet. JDBC is a low level API is used to invoke or call SQL command directly. The
required SQL statements are passed as a 'string' to java methods.
Program Code:
3-4 students. Teacher must assign a
separate programn statement to group of
, Write a Program to create a
Student table. Student Table in database and insert a record in a
2. Write the output of
3.
following code
Create DSN Named as
1This program uses typesMSBTE using
I driver JDBCAdministrative lool from control Panel.
ODBC bridgc.
import java.sql":
class JdbcDemo
public static void main (String ares|])
try
DriverManager.registerDriver(new sun.jdbc.odbe.JdbcOdbcDriver):
System.out. println(" Driver loaded");:
String url-"jdbe:odbc:MSBTE",
Connection cn DriverManager.getConnection(url):
System.out.println("Connection to the database created"):
Statement st cn.createStatement):
String str= "select* from student"':
Resul
StringtStext
etrs=st"":.executeQuery(str):
System.out.println("Roll Number it Name"):
while(rs.next()
Dii0er log ded
text texttrs.getInt(1 )+"\t"rs. getString(2)+"n": connttion to the
databsecieo ted
System.out.print(text): Roli umbe nome
St.close):
cn.close): -
John Ooe
Jdne 6 mith
catch (SQLExccpt.ion s)
utPU .
{System.ou.printin("sql error"):
y(connection
Conn: 0hiuey Mono gey-getconnec tion
Cdbuah Useass)j
6taemen tl0)
Sto tement atmk sconn .caeate
(otchC50L Cxception e)
e-pintStackra arpl);
Table
and YeCOrO in5ete.
.......
0 plolovm Indend on re
********s**
IOUa Integotion
6impilified Cx¢ep tion
*******************.
Hondling
XII. Exercise
1. Develop a program to create employee table in database having two columns
"emp id" and emp name",
2. Develop a program to display the name and roll no of students from "student
table" having percentage > 70.
Maharashtra state Board of Technical Education 99
Atvced Jevn PrormnE 22817)
(SpaceforAnewer)
Tabl@
ployee
fmpostClasscspoLoCro
PUblic ags)
moin(sing)
uoid
PUblic 2iatic
Jdbctmysal:/lletolhO5t3306J
y00Y dbuy
SLhing da4g bose_oomej
e*****
c.aeko nectioN
anOgeT.ge
03i0er
tgcconDRtion conD: 5t0Benont(1)1
e******ee
(1e0te
(onn.
S+Oement gtm
NoT
("CRCATe TABLE
5tmt-exeCute Upda Lo PRIMARy *******
CotCh (50LCNCeptioh )
e. prin tstacroce5
10
Maharashtra state Board of Technical Education