0% found this document useful (0 votes)
275 views121 pages

AJP 22517 Lab Manual All Practical

Uploaded by

Omkar Kotkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
275 views121 pages

AJP 22517 Lab Manual All Practical

Uploaded by

Omkar Kotkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 121

Ready made Practical output Available Checkout Now

r I r:ef'i\sanke\OneOnve\Docume'lts\AJP Programs Ched1)o>:CiroupDemoJava - �atepad .......

r□ I 9
File Edit Search View Encoding language Sel1mgs Tools Macro Run Plugtns Window 7
�e 0 � 1o1 I I o. c. I 0.. a. I [;) B I � q ·=- <I> Clrl Cl Ix "' � I @ I»
E3 CheckboxGroupOemo Java Cl
1 import java.awt.*;
2 class CheckboxGroupDemo
3 {
4 CheckboxGroupDemo()
5 { 1§.1 CheckboxGroup □ X
6 Frame f=new Frame("Chec-kboxGroup");
7 CheckboxGroup cbg =new CheckboxGroup();
8 Checkbox cl=new Checkbox("C++",cbg,false);
9 cl.setBounds(lOJ,_ - );
10 f.add(cl);
11
12 Checkbox c2=new Checkbox("Java",cbg,true);
13 c2.setBounds(_ , l , 1 , );
14 f.add(c2);
15 f.setSize(1 .., 0);
16 f.setLayout(null);
17 f.setVisible(true);
18
19 public static void main(String s[])
20 {
21 new CheckboxGroupDemo();
22
23
24

II
ava source tile length : 503 lines : 24 Ln: 13 Col: 11 Pbs: 303 Windows (CR LF) UTF-8 INS

P Type here to search


Oh no! Its Incomplete Exercise Output Go and check whole Practical
output PDF DOWNLOAD NOW
C: lJsers\saok.e\Oneor·w1,Documents AJP Prngrams\Cor,panents.ExampleJa 1a • Notepad-..- X


file Edlt Search View Encoding language Settings Tools Macro Run Plugins Window ?
o'J ei -" 1r. 0 ®J e I : l.o I "? � I °' a. I ©. E\. I § Ii}] I =:=; 91 ·=- <!> Clll � .fx � fo3 I @ t:1>
�ponentsExample.java (31
1 import java.awt.*;
2 import java.applet.*;
3 public class ComponentsExample extends Applet
4 {
5 public void init()
6 {
7
8 Label l=new Label("NAME"); ,. Applet Viewer. ComponentsExample.c... □ X
9 TextField tf=new TextField("Enter your college name"); Applet

10 TextArea ta=new TextArea("this is a multi line text area") NAME j�nteryourcollegename

11 Button b=new Button("OK"); thlslsamuttilinetextarea

12
13 add(l);
14 add(tf);
15 add(ta);
16 add(b)
17 }
18
Applet started

ii C W1ndows\System32:\cm• .exe - aprleMewer ComponentsExample.html □ X


•11Lr1 � •t 11 )), [V ""'1 r Jn ,1 Jll('1 l'h]
() fill sc1t ( ,�i, r,1t1nn ,-dl 'lfht-o, ,'-..f'r✓t"r"

( IJ ere, c,dri.:e 11 ..,[1111.,0\[l1rL!ll.-'flc, ,\lP Pr hra11,;,, JG cH � 111i, r..,rt...rxcmple ]c'\ci

( \I-.,, ,._\s,,,r Kt 11 [r J\ \D•�1 /1\e' t... AH Pr �r ,rn,;,, 1ppl, t\ Jt' 1, r I w1p n• r t-...f ;,r: i!IJ Ii f 1ml

II P
ava source file length: 349 lines: 18 ln : 17 Col : 6 Pas: 347 Windows (CR Lf) UTF-8 INS

Type here to search


Cl

·=
� C:\Users\s.anke\OneDnve\Documents\AJP Programs\Selectlanguage.ja..,,a Notepad+-+-
F1le Edit Search View Encoding language Settings Tools Macro Run Plugms Window ?
ol e, .,.. - @ I:)) e I db ID rn I 9 -" I 0. C. I ©. 0.. I [;) 1!3 I 3 cu </> Ctil l!!!l fx � ::a:; I @
� Selectlanguage.java Ci

1 import
2 import
Applet Viewer Setectlanguage.class □ X

3 public class
Apple!

4 {
select language r Marathi r Hindf r English r Sansknl

5 public void init()


6 {
7 Label ll=new Label("select language");
8 add (11);
9
10 Checkbox cl=new Checkbox("Marathi");
11 Checkbox c2=new Checkbox("Hindi");
12 Checkbox c3=new Checkbox("English");
13 Checkbox c4=new Checkbox("Sanskrit");
14 add(cl);
15 add (c2);
16 add (c3);
17 add (c4);
18 }
19 }
Applet started.

111tr l1't l 1nr1 , � IV, "1, 1 J\\ n l 111,1 1 J,1,,]


(t l ,UL •t l L"I PLI, t llll 1dl 11,) \<., r t'':.t' i"d

( l)<.,," <., dlki:'1(r1eflr1 ..... \[) (1.11,:rt< /1lf rr )t,fc!!l'-').--l\cH '-.elt->tllcHflJcigr-' ]:1'd

I IJ��'"'"-1rl<;t 11,�[lr1v,, [1 L•,me•l<., /1lt �r 1,0tdTl">>np�lr-' l\1, itr C,t']t-'!tl,-H1_'1,df,... ltml


Java source file

P Type here to search


length: 360 lines: 19 Ln: 3 Col: 28 Se!: 1411 Windows (CR LF) Ulf-8 INS

Ready made Practical output Available Checkout Now


Ready made Practical output Available Checkout Now
�d�va�n�ce�d�Ja�v�a_!'.P�ro�g�ra�m�m�i1�1gu(.=
22:.:5'....'..I :.J.7)'.__..__________________
__________
Practical No. 2: Write a program to design a form using the
components List and Choice.

t
I. Practical Significance: . fr .
The List and hoice components lets the user choose one option om hst of availab!
options A hoice is displayed in a compact form that requires you to pull it doWn
see the li t of available choices. Only one item may be selec�e� from a _Choice. A Li;
may be displayed in such a way that several List items are v1s1ble. A List supports the
lection of one or mor List items.

II. R le ant Program Outcomes (POs)


• Ba ic knowledge: Apply knowledge of basic mathematics, sciences and basic
engineering to solve the computer group related problems.
• Discipline knowledge: Apply Computer Programming knowledge to solve the
computer group related problems.
• Experiments and practice: Plan to perform experiments and practices to use the
results to solve the computer group related problems.
• Engineering tools: Apply relevant Computer programming / technologies and
tools with an understanding of the limitations.
• Individual and Team work: Function effectively as a leader and team member in
diverse/multidisciplinary teams.
• Communication: Communicate effectively in oral and written form.

ID. Competency and Practical skills


To develop standalone applications and web Application
The practical is expected to develop the following skills:
1. Able to develop an applet/applicati_on using Choice and List components.

IV. Relevant Course Outcome(s)


Develop programs using Gill Framework (A WT and Swing).

V. Practical Outcome (PrOs)


Write a program to design a form using the components List and Choic

VI. Relevant Affective do�ain related Outcome(s)


l . Fol1ow precautionary measures.
2. Follow naming conventions.
3. Follow ethi cal practices.

Minimum Th oretical Dackground

. List: reates a list from whi h Lh u, r 'an ho li..·t it m ...

Constructors:
List() II allows only on iL m to b I t ·d
List (int numRows) // no of ·ntri • will al , i ibl
List (int nuniRows, Bo lc,in rnultipl I r ·I
ct
multiple items. If it i fal th n only n item ma

6
Maharashtra state B9ard_ofTechnipal ducation
·············
---------
�dv�ru�1ce�d�Ja�va:_!P�ro�gr�am�m�in�g�(22�5�172_) ------ �

············································· ··················································
............
.............. ,,
..... ...... ...... ............... ...........
...... ........ ........................................................................ ............................... ...............
··································································································· ········· · ········
.. .... .... . ······ ······••1
........................................................................................................................................................................... ...... .. , ·
.. .... .. .
...................... ................................ ........................................................................................ .............. .. ...... ........ ·
··· ········•·,
Ready made Practical output Available Checkout Now ♦ ••• •• • • ••••••• � • t. ♦ •••••••
t ♦ •• ♦ t • • t •••••••• ••• ♦ •••••••
♦ •••• • •• • ••••• • • ••••
••• ••
♦ .........
..... . . ♦ ♦ . .. . ...... . . . . ♦ •••• ••• ,

XIII. E rci e:
I. De elop an applet/ a�plication using List components to a dd names o f 10 d1· fferel1J
cities. · ·
2. De elop applet / application to select multiple names .of news papers
(Space for answer)

J-":......'�0..f��t.....J.9-.Y:.�.:..9-.P..I.:..'�...)...............................................................................
'\ \c ' \ •

.
\ •

....... ,.f.0.� Q;.L r.... J.9.Y.:9.. q_f.f. � .e.i..�..�..J........ ..................:...................................................


\

t ••

... . �\?.1,\....c.v�.rJ...D..�.ffgr:f.W...t..\.��H�J. ...�±Y.ld.J:...�.\.U:.............................


\ i
... .....:...............................:.............:.........................................� ...: ...............................................
. . . .fu \)·.�.:.::vo..\.c\....\.n.\. .t ....(>.....1-...........................�. .:.................... . ..... . . .. . ... .. .
...... L\5:\.-- ..-JJ..-..asd--d.. �. :-0ew .. L,Jt ( :;.,.. t.'o.l-l.U} ................................ .. . .
.....!.\.:.�.d..d....C��..�E�\�tr.�'..J..i..........�t�..�.4..(.'.�..�.�·.a.�.':)J.............................. .
.....:-\.l:.. �.d.d ....�.��.A�'t!30o.9.h.�d.'.))....�.t ... .Q-.0..1.J.:�.M.�.'};\.bg.{: ..(..JJ... . . ... . . . 1

.....0.�.�..?.-:9.-.9..��.�..�.�.r.��..�'J.J........�.\..Mcl.C�..s.2�.Y.\.f..�.�.�.:l. -L ....................... .. .
....:-3..'.:..°:�.d t '' - ��-�'-'�_?:t.�.'.:.L;,..... ,�-�--'..?.:�.� ..C'...9J.f.:.i_g0,_a.,_b.,Cld. '.'.J )•...... .... ·

\?
J l.".. � a. (\.J e.J .'' Ji ..... ..1.,.:.o..d.d.( �°'_\-�a.a,�,,. J;......... .... ...
....J. _o..J.. ..... t, .. (I

:
---�-�-��- .... �-'--)•..�. . . ......... .........:.•• : : : : : : : : : : : : : : : : : : : :::::::::::::::::::::::: : :::-::: :·::: : :: ::: ::::::. . :

.. · ..
Ready made Practical output Available Checkout Now

� C:\Users\s.anke\OneDnve\Documents\AJP Programs\Mult.JpleNewspaperNames.Java Notepad ..+ Cl


File Edit Search View Encoding language Settings Tools Macro Run Plugms Window ?
ol e, .,.. - @ I:)) e 1 :::,i rn I 9 -" I 0. C. I ©. 0.. I [;) 1!3 I 3 cu
IE:I MuttipleNeWspaperNames.java f3 j
·= </> Ctil l!!!l fx � ::a:; I @

1 import java.awt.*;
2 import java.applet.*; Applet Viewer. MulttpleNewspaperNames.class □ X
Applet
3 public class MultipleNewspaperNames extends Applet
4 {
5 public void init()
6 {
7 List ll=new List(�,true); Toe Indian Express
Hindustan Times
8 11 . setBounds U , � u,l , 1 , l - ); The Hindu
9 11.add("Times of India"); Maharashtra Times
10 11.add("The Indian Express");
11 11.add("Hindustan Times");
12 11.add("The Hindu");
13 11.add("Punjab Kesari");
14 11.add("Maharashtra Times");
15 add(ll);
16 setLayout(null);
17 }
18 public void paint(Graphics g)
19 -{ Applet started.
20 repaint();
21 }
22 }
r'llt , ft ,,11H�,,\J<; rVtr qnr
\l J I'll, l'- ... , 1, pi 1' 1 11
1(1 (l I l(l4--; 1 18]
:d I q)i! c.. r ,....'-t, \t\

I 11<.tr'-\'-alKt {J.!D ,\t' [li l1 m,rt'- ,11r P•,�r-JrJl',)]<:1 d( 'h]t1:l,',,,c..�dlt'rtl llr'- ]r1 c:

1 llc..,r'- -.,,11 K' ! r fl n, D tt11nert'- ;;, P P ,lfr illl'- cir J,t\ 1,,,,r 'ult q 1, 1i,• 1 p p,, 'lorn•<.. t tnil

II
Java source file length: 423 lines: 22 lJ1: 8 Col: 26 Pas: 174 Windows (CR lF) Ulf-8 INS

fJ Type here to search


Ad anced Java Programming (22517)

s�,\{\ s 't'o\ e. l \ry u_e._ ) ;


5e_ � l O e.a.__ � 0 " ( "Lb O , '2.. � 0 ) i
Se.� lo.'joUt(_n�w tn�ilLct'jol-lt ( �,S-) Jj

�ltb\i l �ta.-\1 c vo,'ol

"(\e_w Lnr-n' J � bj s- C);

Ready made Practical output Available Checkout Now


XI. Result (Output of Code):

......'?,{.�iC:C.Cl./'.Y.1 ...•. :.X: ......$.½�-�.eS. f..f!,t ,U j--......,.................... . : : : : : : : : ..· · ·....


..............�..........................�.'Ci
...................................::....:............. ............... . :::
...... · · · · · · • •"'''''''"'
•••• , •• • ,,,, t • • ••••••
•• •, •• • ••••• p ., • • • t •• t ••.ff t. •• t•• f • • t • • t • •t t • t I• •• t I• t It t,; ti, ti,• t • t• • ♦ t t • ♦ t ♦ • ♦ 6t ♦ ••
t • • •• ♦ • • ♦ • • ♦ ♦ * • ... • • • ♦ •• ♦ ♦ ••••••••••

XH. P acti al Related Qu •stiou.


Note: Below ,:lve11 are j'?
w sample question for referen
more such questions so as ce. Teache r mu t de rg. ,,
to ensure the acl1 ievemeni'o
I. Give name of default f identified CO.
Layout Dr Diffi r nt on
2. List the names of l3o tain r
rd rLayout r.egion ..
3. Write the default hor
izo
4. Write th c use of Inset ntal and verti�a.1 gap in FlowL�yout
_ s in borcl r layout.

Maharashtra state Board of


Technical Education
14
Ready made Practical output Available Checkout Now

( pa for an er)
Q
cy. \.......-
....- ..... :. .................................................................................................................................
....-
�.....B.9..�J.�r:r\-�19..�J.. (.).... � .s ... :r.h.L..g\�J.� ....\.t ...\Q1-0.½-. :\... fqy .... 1:.r.9: ....e.
. .0.Dcl . S\9.w..l9:.�.o.Y.-:.\.JJ ....\. .S ..• \h.€.....c\.�f �Y.-..\.i... \�:j.o.v..J .....t.Q.� ...............
. .
. �f.?.�..�±.. f. .. ��D..�J... : .................................. ·······............................................................
...... .:
. ....................................................................................................................................................................... ............ .............. ............... ...... ..........
!...........................................................................................................................
..
�-'2-:). ........................ . .

� .....i.crr.d� ..\.�':j.Q.�.t... rxsr:1�0J..� ...thst,.....C:�.f�n�.ti.....).':O......�Q.�.T.... .


.......\J.r:J.R-.«:1��.... Qf ... �.\.0.d.�.Q.J. ..... 9.d... :.�9g\_1.... .9J ...... t.¥.l ......��D:\J;Y. ..� . ...
. .............
·······':!:.::C,1R.0.!.....9.f ...To.�... .BR:rJ.�� ..Lqj_.9.�A_.:...............................................:...............
........................\J....t�.C?.��·········0.·Q·@:Ttl.: ......:..................................................................
· .
...................... '2-) . .s.0�� ......... S O_,ut\:1.........- ..................................................................
·······-.............'3)_ . -f,Q.J ,\- .............t: �..�T . .... _....·...· ..............................................· ·-·······..........
. .· . . L\) �\- k_\ E-s,· .
-- .
... .............. . .. �) .. e:�x\t�_. . ..
. .. �. . c.. f:t\T t \2- ........................................ ·....········..........
·1)- -�.. . . .... .. ......... . . ... . ....... ... .. .......... .................... .... ................. .. .... . .. . .... ..
. .. . .......... . . . .. . .. . .. ..
... Th
.
.. .... . � . .
. ..
�... ...C..0:0.�.��t(c(.... r.�.o.s?.\�.J.0.Y.\.1..(.�.0.�..J.b.9..':-:?....t ..;f:\.t.....h......�.!-,
.. . . ..
.

...................... J.�.':Y.\).) ..... .S.fe.c:..L.F.t.�...�.ho:.J..\.-:-:h:�r.9..L ....0£\J........·...e_'Y.h ... 9..


. . . .cl: .t9,.c.:..�.... :-j.... ncr.a..: . . .
�.0:d......Y�:.rb:.�9-.\.... �h.�.�.'h .....�.t.�.r .....£....
......... x�.� ....S.,.Q....�....Q.:.(9.½:0d. ....�.....0.?.mP.�:0.�l......................................
.... · .. . . . ... ... . ... ... .. . .............. . ... . . . . . .. . . .. . .. ..
· . ... . .
)·· ···········,. . . .. . .. . . . . . .. .
. . ... .... .. . .. .. .. . . . . ..... ........ . ....... . .....
)"
........ ...
..
. , ... ........... ....... ............ ... , ................ t t t ....... t .... . . .. . ............... .................. .............. ...................... ♦ ...... ... ........... ...
.. .. .
...
. ............... ... ..

......................... ................................................... ,, . ,..... �............ .................................. "·················· .. ····· ........ ....... ................ ............... .. .. . ..

........... �:.................. �.....


.
.....\.... .. .'�..!..\................. ............................···. ··············•··,··
....... . ........ ................................................... .................
.
····. ··....... . ..

, .
.................................................... ...... ............................................................................ ........... ....
...........\ -.

•••••••• .. ••••• • ••• ..• ..................."!'....... .................. , ....................... •It♦ ........ 0 ....... . ..... , •• ••I ..
....... .. •·• •••••♦♦\♦•••:..

................ ., ............................................... ":·:·..·:···::· .................... .....................................: ... . :.: .. :...


. ... . ..
.. ... . .
... .

:
.... . .
. .......... .. ........................ ............. .. ........... .... , :····-······ .... · .... ................................. ............. .. ........ , ....... ..... .. ... .............
.. ..

.
.. ..

. . .. · .
. . .. : ..
..
. . . . .. . .
Maharashtra state Board of Technical I ducatioo
15
...
..
. .
. .
.. ......
Ready made Practical output Available Checkout Now
Advanced Java Programming (22517)

Practical No. 4: U e of CardLayout to write a program to create a


two-level card deck that allows the user to select an
operatino ystem.

I. Practical Significance:
The CardLa out cla s manages the components in such a manner that only one
compon nt i vi ible at a time. It treat each component as a card hence known as
CardLayout.

Il. · Rele ant Prooram Outcomes (POs)


• Ba ic knowledge: Apply lmowledge of basic mathematics, sciences and basic
engine ring to ol e the computer group related problems.
• Di cipline knowledge: Appl.y Computer Programming knowledge to solve the
computer group related problems.
• Experiments and practice: Plan to perform experiments and practices to use the
results to solve the computer group related problems.
• Engineering tools: Apply relevant Computer programming / technologies and
tools with an understanding of the limitations.
• Individual and Team work: Function effectively as a leader and team member in
diverse/multidisciplinary teams. ·
• Communication: Communicate effectively !t:i:O�_al-_and written fonn.
. .

III. Competency and Practical skills


To develop standalone applications · ··· ·
The practical is expected to develop the following skills:
1. Able to apply different layouts !O Applet� Frame and Panel
2. Able to demonstrate the use of different types of Layout Manager

IV. Rele ant Course Outcome(s)


Develop programs using Gill Framework (AWT and Swing).

V. Practical Outcome (PrOs)


Write a program to demonstrate the use of Border layout showing four button· �f "fi ur
sides of an applet with captions "left", "right", "top" and "bottom"

VI. Relevant Affectjve domain related Outcome(s)


1. Follow precautionary measures.
2. Fol1ow naming conventions.
3. Follow ethical practices.

VU. Minimum Theoretical Background


Constructors of Card Layout class
1. Car()LayoutQ: crcaLes a card layout with ,1., ro horizontal ,nd rti at �ap.
2. CatdLayout(int hgap, int vgHp): er nt ·s a ·ard In out with th gi.. n h riz ntnl
and vertical gap.

Commonly used methods of Card Layout cla ,.


1. public void next (Contai�er parent): i u ·cd to lli'p t� th, 11 ard of th giv n
container.

Maharashtra state Board of Technical Education 19

..... . ...
Ready made Practical output Available Checkout Now
.d an d Jovo Pr grnmming (2�2�51�71)____________________

..............................................................,
···········.....................................................................................................
.. ........
................................................... :.......................,.............................................
.............. .. ,,
..
........................................................................................................................................... ............................................ ..
,

............................ . ....................... ....... ......................... ............ ... .. . .... ......··�


.......................................................................................................................................................... ,
,

·················"····························· .··························································· ········,


.....................................................:....................................................... ........
................. ·· ································-··················································· .. .....,
......................................................:·········.. ·········································· . . .·.-··:·
..................................... .. :......···: .................................................. . ....
.... .
. . . ..
................................................................................................... ..
.. . .
........................................................................................................... .. ······
................. ·······.................................. ········...·.............................................�·· .. ..... ' . .. ·······
Ready made Practical output Available Checkout Now
XIII. Exercise
1. Find errors in following program and display output as show
n below.
import java.awt. *;
import java.awt.event. *;
public class MenuDemo 1 extends Frame

MenuBar mb;
MenuJtem ml,m2,m3,m4;
Menu mn;
MenuShortcut ms ;
MenuDemo I.()

sctTitle("McnuBar I mo");
setSizc(500,500);
sctJ ,ayoul(null);
ms- new McnuSh�wlcut(' l • Ev
nt.V );
mn· new M ·nu("Filc");
mb-.ncw Mcnul3ar();
: ml� new Menullcm(''Ncw ... ");
m2-ne� Mcnult m("Op 11...");
m3-ncw Menuftem("Savc As
m4=ncw MenuJtem("Exit",m ... );
");
. Maharashtra state Board of Techni
.._. cal Education
············· .
Ready made Practical output Available Checkout Now

.
Jo.."' �. C\ wt . f_'V � • ¥ '

• I
. ' .

�------+__c_��-�� (
L------·, .s L1·1...� l G. () o J .6�('.)_t>�)�· _______· _, _· ___.,;.___._· ---�
:....--------' £�- S�ViJ' �'o tt_ :{�uz.) J

�----n-
t�'; <, -Vo'\cl, HP ,-,3\a.� '-'o.i\J cJ l
\b .. SIL\, (:'x t ( \ �ou O('(Q_ � -n \
-}
Ready made Practical output Available Checkout Now

Cl

·=
•C\Users\sanlf.e\OneOr1ve\Documents\AJP Programs\JTreeE.xamp!eJava - Notepad ......
File Edit Search View Encoding language Settings Tools Macro Run Plugms Window ?
� ei 131 li;\1I @ IE)) e 1 :::, 11. I 9 .,, I o. C. I ©. e.. I § 1!3 I :::; cu <!> CtIJ l!!!l tx � ::a:; I @
f=l JTreeExample.java f.3
l import javax.swing.*;
2 import javax.swing.tree.*;
3 import java.awt.*;
4
5 public class JTreeExample
6 {
7 public static void main(String[) args)
8
9 JFrame JFrameMain = new JFrame();
10 JFrameMain.setVisible(true);
11 JFrameMain.setSize(4 ,4 , );
12
13 DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("India"); □ X
14 India
15 DefaultMutableTreeNode maharashtraNode = new DefaultMutableTreeNode("Maharashtra"); [jMaharashtra
If [)1i1umt>a1
DPune
16 DefaultMutableTreeNode gujrathNode = new DefaultMutableTreeNode("Gujrath");
DNashlk
17 rootNode.add(maharashtraNode);
18 rootNode.add(gujrathNode); DNaopur
19 [')GuJrath
20 DefaultMutableTreeNode mumbaiSubNode = new DefaultMutableTreeNode("Mumbai");
21 DefaultMutableTreeNode puneSubNode = new DefaultMutableTreeNode("Pune");
22 DefaultMutableTreeNode nashikSubNode new DefaultMutableTreeNode("Nashik");
23 DefaultMutableTreeNode nagpurSubNode = new DefaultMutableTreeNode("Nagpur");
24
25 maharashtraNode.add(mumbaiSubNode);
26 maharashtraNode.add(puneSubNode);
27 maharashtraNode.add(nashikSubNode);
28 maharashtraNode.add(nagpurSubNode); /11 ,,c, ft \111J 1,c; V 1 1 r ]l1 U l l•44 1 vJJ
29 \ l r 1 , o..,{ ♦t r, i i ,• 11 r• /d I q�t t.., , , "t' \1 i
30 JTree tree = new JTree(rootNode);
31 JFrameMain.add(tree); ( ll'>t'I--, <.,d!l,<,t\lrtD J 1 [) (IJl1lt'r1<., hlP r'•(t' n.., 11\,i lTr,,Fx,•rnp]l 11\,�

32 ( II ti-, <.,Jl1Kt n11,{)r1 t f))(lf!ltl1'-\;\lP r'r(tr f!h>]l\l 1Trlt�Xtmplt


33
34

II
Java source file length : 1.258 lines : 34 Ln:14 Col:10 Pos:373 Windows (CR lF) Ulf-8 INS

fJ Type here to search


Advanced Java Programming (22517)

Ready made Practical output Available Checkout Now


XI. Re ult (Output of Code):

XII. Practical Related Questions


Note: Below oiven are few sample questions for reference�. -Teacher ·must design
more uch questions so as to ensure the achievement of identified CO.
1. rune any four Event Listener interfaces. · · :· ·
2. State the situation when all three events ofKeyListener interface are generated?

(Space for answer)

. ...........····· ............................................···········...... ... ........................ .. ...................... ........... . ......


---+ ...... t ....f.\(t5.�.\/4::\�-o.�:.:r......................................................................................:...
........?-)... T��t.1::.�1.�0.��...............................................................................................
....... 3.)....1--�..�.'..�.\�.'?:-.r:!:.............................................................................................
........':-:).. AdJ.�J.\f.0.�.tl\I\.��.............................................................................
.............·····........... ........................................ . .......... ....... ......................................... ......................
cg. ::-.2............................1................................................................ -- ····························· .......
T
.... D..... �'y)....".lr...Q..b.I�:f.Q.J:\... :Y.su'd. ....kt).f..0':�!✓..�..........�1.i.........J............./... · · J
..�...J;;f.\.lQ.�.�·····�x:.f?.!0.... 0.....\5:g::j..... b9-.S. ....b ...... . .t...d........................
·;;···················�·····;·b�····�;·cf···�·��·�··J····· ,;·�·········;············ J··c°'�···1···�····· �····,:J··;· ···
0. .............

... )... �4�\.\................. :\-......................................... .1........................................................... ! .... .


:-::.. ...'.¥:0. Y.Q�.cl.....W.... �.0 ...r->.:-....\�.�..J............. �·..............� ..... �.......\... .. .£. d. . .. . .... . . . .... .
it::i�;.:;.;:t:��:1.i;�:it.:: :;;�;i:: );:�:i:::· ;:::;LU��i::;;:::::::;/:J L
" 'U-f'\tV"O \...(lld WY\� 0- \<-£.: (1 k>:, () r\-'1�
Mabarashtra state Board of Technical ducat ion 5
...... ........
...
. . . ...
·. - · · . . .
.. .
Ready made Practical output Available Checkout Now
- -
- ----- -==�� ---------
g!_1(222;5�1:?;7)1___-----
���dc_!J�n �a_!P�ro1g,i:1ar �m�n�1i�n
t O demon
strate various mouse
o
·te a pro0 ram
ner and MouseMot·
10n
Practical No. 11 : W ri M o u se Liste
events usmg
.
ce.
Ii tener interfa

I. ionificance: . .JStener interface are. u sed to implement the


. eMot1 on 1 o
L1 ten r and Mous . . ed when the mo use is clt ck ed , d ragged , dr pped
that are cre at
difii r nt typ f vents ent.
r l a d 1�t r d and e ·te 1 d in a compo n t
erform some ac 10n in that
to h an dl th eve nts and p
mt rfa s lets th use1.
e e
Th
nt.
, s (POs) . · :' .
n. Rel ant Prooram Outcome of ba
.
ma th emati cs, scie n ces and basic-
ply kno wle dg sic
• Ba ic kn;wledge: Ap e
er group related. pro
blems.
noineerino to solve the comput
. puter Pr?gra mming knowledge to solve t�e
o/ iplin/knowledge: Apply Com .
·
omputer group rela ted pro blem s .
e: Plan to p fonn xp eri � ents and p ractices to use tpe
• E periments and practic er e
ms�
results to solve the computer group related proble
• . Engineering tools: Apply relevant Computer pr og ramming
I technologies ancf··
tools with ·an understanding of the limitations. .
. '" . .· . • Individual and Team work: Furiction effectiv ely as a leader and team member in
diverse/multidisciplinary_ �ear1i:
• Communication: Commurii�ate effectively in oral and written form.

III. Competency and Practical skills


Develop ":eb �nci stand-alone applications using advanced concepts of Java.
The practical 1� expected to develop the following skills:
1. Able to implement the events ofMouseListerner
2: Able to im�lement the events ofMouseMotionLi stener.

Relevant CoufSe Outcome(s)


De1elop Progr3:rri� !O handle events in java programming.

Pr�ctical Outcome (PrOs)


ilnte a program to demonstrate various mouse
events using Mous Li t n r and
MouseMotionUstener interface

VI. feJ�o�t Affe tiv_ domain related Outcom (s)


. ow precautionary measures.
2. roil ow naming conventions.
3. follow ethical practic s.

VII. Minimum' �fhcor t·• a1 Backgro


un
The .Java's MouseListc;ncr int ·rfa d
c' all
perform· som· e events usi.ng mous ow lh us r to handi the events when the user
Mousebntcred, MouscEx't1 et,I .Tl, events ar
Mou e C licked MousePress d•
and Mous r lea ed..
••
The list of available mcll1od.
s
1 . vo1·ct mouscClicked(Mo arc·
usc
. no ve
. nt me)
..
Maharashtra slate Board of Tech n1c .. .
. a, 1 l:duc:ation
58
Ready made Practical output Available Checkout Now

Cl
·= </> Ctil l!!!l fx � ::a:; I @
� C:\Users\s.anke\OneDnve\Documents\AJP Programs\MouseDraggeoanoMoved.Java Notepad• ....
File Edit Search View Encoding language Settings Tools Macro Run Plugms Window
ol e, .,.. - @ I:)) e 1 :::,i rn I • -" I 0. Q. j ©. El.. I [;) 1!3 I 3 cu
18 MouseOraggedandMoved.java ElI
1 import java.awt.*;
2 import java.awt.event.*;
3 -public class MouseDraggedandMoved extends Frame implements MouseMotionListener{
4 MouseDraggedandMoved(){
5 addMouseMotionListener(this)
6
7 setSize(300,100);
8 setLayout(null); □
00 X
9 setVisible(true);
10
11 public void mouseDragged(MouseEvent e)
12 Graphics g=getGraphics();
13 g.setColor(Color.BLUE);
14 g.fillOval(e.getX() ,e.getY() ,20,20)
15
16 public void mouseMoved(MouseEvent e) {}
17
18 public static void main(String[] args)
19 new MouseDraggedandMoved();
20 ii C:\Wmdows\Sys1em32\cmd.exe -java MouseDraggedandMoved □
21 hi .., 1t , 111":lruc.. IV\! q r lll fl Iclfl1� l ,/]
1�) llllr p-..u�t I pr it .._1 t, ,\ll 1;.;htc, rt''-cr ej

( \ll-..,-,r-, '>dl" (!e!J 1 t-' [J1 •mt'rt-..\\l� �r•lf,rrlfll'>>]1 c1• 'l!,',t'[)rd6f:;t'ddr,r, t', ]d cl

l \l t"r 1-.. c1t>(t-' (rerJrl�t-' [)Hurnt'rt-.. AlP Pr(�rrlrn >],• d h_,11-,�[Jr,, ,,t'e,•r 11,1 el


Java source file

P Type here to search


length : 603 lines: 21 Ln:12 Col:32 Pos:388 Windows (CR LF) Ulf-8 INS
Ready made Practical output Available Checkout Now
Advanced Java Programming (22517)

·······················································································································································
: :: :: :t: : : : �: ��; f�: ::S.:t;:;; :�: :::;;::�i: ;9-X;:IS. i::;:;:�i.: :cs.:: :iii.J.>: ::
.... . .... ..... ········································· ········································J· ....... .... ··························
............ :J.t.�.�.�.�.. .£�...n.<!:.'-?....'1.f�9':�.� ..C�.Y0.$.f�.��.......s.\.�.�.cA....�0.0.f.J.u/
: : : ::: }�9;..;�:�J.i�:��J.:::::;;;::��:i:::i:::;:;:0.: ::i:��:;j:��;di:,:·:�:�d.:?>.:J:
·······················································································································································
···········7.\���.\ .....0..� ...� ..�.�� ...�t0.�.�J..(.��.J?<3.ff..�.Q.Y.Q.�-::.J... J.........................
............ �.\.: .. 5..�\:Qo..�:a.d.J. ...l�.�.1....�.�:9..1.8..'?..1... �.9..).. !, ..........................................
...............v..Q.\�.e..:..}.�\.3.9..lf..D.d.I. ... .l\<?...?..J...\.9.�.2.\�..?..!..?.�.)../ ............................
· · · · · · · · r�·�d· ·c·v;·�·�e:J··· ·;:··. . . . . . . . . . . . . . . .. . . . . . . . .. . . . . . . . . . . . . .. .:· ·:
.................F�..a.d d. (._,l.\.. J.). ·..................................................................... ·.........................
. . . . . . . . r� . .s.�\ . ..s.,·.�g... .t.?.?.�..l.�..�.�..1...;...........................................................;.-...· �..:.. :.-: _· ·.
················· � ·.···$.:<??.t\.�'J.Q��\-.. (.D.0..�.. �J;................................................ ::::.:: ....-.. :.: ... :......
r_
. . .
................£.:.5.:Y.v..t'.I.�.b.\.� ...l.\:1.�.�. ). 1.' ................................................ :... :..:.:.:..:...........

�:�: : � ::J: ::: : : : : : : : : : : : : :: : : � : : :::: :: : : : : : .:. . . . . . . . . . . . . . . . . . . . . . . ·.: . .... . . . . . . . . . . . . .


········}································································································. ·······:.....................................
........................................................................................................................................................
..............................................................................................................................
.............................................................................. .. .............. .. ......... ......... ........................................................................................ .
....................... . ........ ........................ .....................................................................................................
" •··
......
................................................................................................................................................................................................................................
.. . . . . .. .. ... . . . .
.. ... .. . . ♦ ..... ,, ..... . ..... .... .. ........ . .... .... .. ... .. .. ... .. ... .. . . . .. .. . . . . .. .. .. ... . .. . . . ... .. .. . . . .... . .. . ....... ......... .. . . . . . . .. .. . .. .. .. . . . . ...... . ,. ... .. .. ... ,.
. . .
.. .
.

..................................................................................................:......................................................................................................................................................................................... -.

..

.......... ...... ..................................... . .... .... . . ................... .............. ......................... ....... .............................................. .
.. . ................. .... ...................................... .... , .... ............ ♦ ......................... . ..
.. ,.............. ............. .... ..................,. ................... ...... .. ...................... . ......................... .
.... .

.... .. .. .. .. .. .. , , ' "

•·••••· •··••··· ·•· • ••••· •••• ·•• •• .. •• • •• ••• ••·•••• ·• .. ••••••I••••••••·•"•• •••••••"•·•••••••••••••••··""• .. •••••• ••·• •• •
•• •• • · • • • • • •··•····· ••·•·•· ·

................................................................................. ............................................................ .............................................................................


' '

........................ ............................................� ........... .............. ............................................................... .............................................................::.........


.. -; , ,
..

. . .
·•: ............... .. ............. ............ ........... ....... ........... .. . .... ..J ..... " ..... ........................ .... ............ . ......... ........... ...... : ...... ..... ....... ........................................ ......... .

•-. .......................................................................................................................................................................................................................................
. �a� rashtra �tate Board of Technical Education
� 67

. . . ...... ....... .
...
..

. . . ... . . .. . ...
.. ... ..
ing (22S l ?)
Advanced Java Programm

uir d (Ad<litional)­
VIII. Resources rcq
Nil

l)
IX. R ourc s u cd (Additiona

Name of Quantity Remarks (If any)


Broad Specification
R
. \

Prooram Code: Teacher must assign a separate program statement to group of


3-4 tudent .

1. E 'ecut the following code and write the output

importja a.io.*;
importja a.net.*·
public class lnetDemo

public static void main(String0 args)

try
{
InetAddress ip=InetAddress.getByName("localhost");
System.out.pr!ntln(::Host Name: "+ip.getHostNameQ);
S)'stem.out.prmtln( IP Address: "+ip.getHostAddressQ)-

catcn(Exception e){Systern.out.println(e);}
J
J
Ready made Practical output Available Checkout Now
XI. . t Jt (Ou p Jt of 'od ):

-r-VJ0f�1 c�, f.<11f ;�_:.': t .\.)to.1,J............................................... .......................... .


,·... ..

•• ¥.T
". ·• "•••••• .. A ... •·1•• I .,.,..,.' )
J ..<,!...................... :....... ,.,. .. ,.................. , ... ,..,, ... •••••••••••

�����:::::.·::::;:::::::::::::::::::::::::::::::::::::::::::::::::: :::::: ::::::: ::::::: : ::: :: : : : :: : :: :::...·•···· .......... ::�. :�: ::�::::
XII. J•ractical I< ·lah·d <Ju tion
Note: Below givn, " "j,•w ,11mplt• lJIW\l/om /or rt• ·rn . , I •11cl1a
. ",.
n rore wch qtte.\fimr\ W> tM to l'll\llf·,, 1111' 11d1 i' •v,,,,,,,,, I I0/ 1de1
mu, ·r tie ·igll
. 1ti'i
.., t•ti ( .v.
.,..
. I . W r�tc
· o11y I <,ur c 1 ·Ill ·n:n ·t,• I, ·1wl l II IPV I urnl II' b.
2. Wr'.t • U�c ll'-,<.: c,I tclByN:.11J1t:() .and gl't IIH. Nam. _l 111 . lhod.
3. W11t�tl1t'>lq>•,tc,a'>,;igull'·•idd il: ..,· l ll Otll Ill u: 11111 •
·

Maharashtra !>talc Board 11 1 ·1 cc.lnli•·al . �---------------------


.,, I ·•'tlu CillU>II
76

.. ... :.· . . .. .
Ready made Practical output Available Checkout Now

C-\Ust:>rs.,sank:e\OneD�1\!t .Dt:M ,1rriern.s,_AJP ?rogram.s\Retr1\lelP.\dd,ti5-Jav-, Nnteoad - X


File Edn Search View Encoding language Settings Tools Macm Run Pfugms Window ? X
6) ei "" 0@ e 1 ,,, "' rn 1 '9 1 a. c. 1 0.. e. 1 I;) E:!I 1 :';"; 'I •=- <t, w � f,: � ::o:: 1 @ L
8RetrivelPAddress.java Cl 7
2 import java.net.InetAddress;
J import java.net.UnknownHostException;
4 import java.util.Scanner;
5
6 public class RetriveIPAddress
7 {
public static void main(String[] args) {
9
L Scanner sc = new Scanner(System.in);
1 ..
12 System.out.println("Enter Ho!"t Name: ");
13 String host= sc.nextLine();
14
15 try
16 {
11 InetAddress ip = InetAddress.getByN-ame(bost);
111
19 System.out.println("IP Actress of Computer is: "+ip.getHostAddress());
'l
catch(UnknownHostException e)
22 {
System.out.pri.nt(e);
24
25
2o
7

Java source file length : 648 lines : 27 Ln, 14 Col: 2 Pos: 344 Windows CCR If) l/TF-8 INS

-� Type here tn search


Ready made Practical output Available Checkout Now

Practical No. 18: Write a program to insert and retrieve data from
database u ing JDBC.
J. Prartical ignifi an e:
ODB i ?'t appr priat for dir ct use from th Java programming language because it
u a mt rfa . Th JDB Pl wa modeled after OD but b cause JDB i a
Ja Pl, it ffi r natural Java int rfac for working with QL. JOB i needed to
provid a "pur Ja a" olution for application developm nt.

II. Relevant Program Outcomes (POs)


• Ba ic knowledg�: _Apply knowledge of basic mathematics, sciences and ba ic
ngin ering to olve the computer group related problems.
• Di cipline knowledge: Apply Computer Programr:ning knowledge to solve the
computer group related problems.
• Experiments anc l i:n:actice: Plan top rform experiments and practices to use the
re ults to solve the computer group related problems.
• Engineering tools: Apply relevant Computer programming / technologies and
tools with an under�tcl!lding of the limitations.
• Individual and _Team work: Function effectively.as a leader and team member in
di erse/multidisciplinary teams. _ .
· • Communicatfon: Communicate effectively in or?l and written form.

ID. ···Competency and ·Practical skills


Ta de elop Dynamic web Application
The practical is expected to develop the following skills:
1. Able to apply the JDBC to create table , and insei:t data in a table.
2. Able to demonstrate the use of various JDBC driv.er and tier application.

IV. Relevant Course Outcome(s)


Develop programs using JDBC

V. Practical Outcome (PrOs)


Write a program to insert and retrieve data from database using JDBC
VI. Relevant Affective domain related Outcome(s)
1. ollow precautionary measure .
2. Follow naming conventions.
3. Folfow ethical practices.

VII. Minimum Theor tical Ba kground ..


JDB APf enables the »ppli ati n I inl �ra l wilh lh lilT•r nt I 1 p or ch\l;lb·1.
Jt is possible to publish vital informali n Ii· 111 u." 11101' lat 1h·1s l n ,\ W'hp }:.u in th Ju a
applet. JOB is a low level J\PI is 11s ·d. to1 Ill�< 1,' r ·nJI S, )I cc mm 111d tlir ti,. Th
required SQL statements are pa . ed i · a '. tnn ' lo 111 n 111 I hod..

.. :. .. . . .·
Maharashtra state Board of Technical ducation 9

. .. . . .. . ..
· ervJet i HTTP dependent
rvl t.IlttpSe J t _ H
1 set of rul s that allo Web browsers and servers to
n r and support the H TP �rotocol Java-
atio n dent on ervlets. HttpServlet is Extended by
t
ll p b tract cla s for the developers for extend to crea e
p C ts.

VIII. Re u r quir d ( dditional)­

Nil

R ourc u ed {Additional)

Broad Specification Quantity Remarks (If any)

Apache Tomcat 8.0


With JRE.
-\1"\ \-�' (.c,r{ e_ \ ':1
�\� w <\dOvJJ I'{)

X. Program Code: Teacher must assign a separate program statement to group of


3-4 tudents.

I. Write a Program to send the usemame to server and server will send the length of
username to client.· ·
2. rite the output of :following code cosidering below HTML is front eni::l and
servlet as back end

loginp�ge.html
<html>
<body>
<form action="
http://localhost:8080/examples/s rvlets/ er I t/Ath nti nti n n I f'
melhod ="P T '.>
· c;cr Namc:<inpllt typ -"te t'' nam ="u rnam ,i br
Pa%w rd: .,... input type "pu � w rd" n·lm ="pns ,, r i"
.,.,input typ -- 11 subn1il",
.,.../fo,n1..,..
/buoy,;
/
"' html,,
Ready made Practical
• I

//Athonti ·at10118L1 vl ·l.,1nvn output Available


importjava.10 l( J�xt j lH1J1, Checkout Now
import java.io.l rinlWr it �l •
import Javax.scrvlcl.S •1 vi ·II�·· ·pt1on
importjavax. rvlel.htq .l lllf S ·rvl ·t;
importjavax:!:iCrvJ t.hllp.l lt11 S �, I ti· ·qu l�
. ·.·
Maharashtra stale Bo�d of1\!olJnioot l�<l11 ation
,. .. . L4
··•······

.... . ...
·. •:· .

You might also like