java unit 4
java unit 4
heytdoptey
indofdapte
4 Meuse Motionapter
y Conpeert tdapter
(ontaires Pdaptes
focy fdapte
)Mouse-fdaptes class TH is an abstnct dos
inplomarotalory fro the
tht pavdes detult
Nouse Listene and MouseMoton
mcthoods in tho
-Listents fntestaces.
that
class
YKoyflagles: # s an abstact the mathod,
fnplomotatin for
Povides dehautt
tho kaylistren idetace.
Prcqnam:
impert jaua. auot. 3
*stgol,M
fava, awt. event,
imqort tample entends kayftaçhj
pule class keypdapter
hey daçteiExampe ("koy fetaptey ");
mes Frane
fiane f= mew dabel C);
Label =
L. setBounds (900,so, 200,20);eal)3
let
Teztoea aaca = new.
038a . set lounds (20,80 , 300,S0)
f. add (l);
foadd (aa);nlothbr .
f setiayct (ull);
f. set Visble (taue);
. oddkaylistens(ht);
publi void, kaypeleased (Kaybant e) i
tezt "aa, qelText ();
stm NoDIcls [ J=tet splüt (us");
:"4 Tds. lerngth + chaaces:"
I, set Tezt ("Wiods
oütput?
hai heb
Cutons Latton4
|Gutton |uton2
lrenuskaypd
tionple
(taue); settWsible fame.
selDetultclose frame
frame.
loo); (zoD; Size set 3
(new add foame.
);("Button TButton for(nt
iz53
TH) seliauuct i=I fame,
uyotlr
); (mew
tame JFrame
mainstring votd statie pubie
laullayoutFonpk class publíc
suofng.*; javaz, import
aut.
; * joua. iport Pgan:
to
thom toToppng
otneat layput: ow 7
ohen tompo aanqsthe
a in
dauot : H dvtdes the containes
) Borcer lert
20glons : ka Nortth, South, aat,
uto ive to specihie
cemponont 0e aolded
Lonter,
giens.
Noth
Gost
Weyt |certer]
South
Sy Compenonty?iud
3Cpenart s an olject hauing gopr
oepresentation that an be displad
the SCeen.
frorm faua, aut. temponn
’Conponents
class
QAe derived
ommen Components i
) Butte
such as tom submiss+on (on
i99er acions ,
mavigoticn
This cdasCaeates alabelled btten
y e : Subnit cancl o îcon butbons
ay dabelsheriu
’pevtdes ceseiphve tet to eaplin the
pupose ef cenponert
’Label is the easiest contol to use
* Enter youy", "paiscard".
3 Textfields :
’ DUow wsess to Input t e t h s
’ H Ts a tert temenerdt thot alloos - to
cditng ot a single ine of teet
seach bexe
Cx: use1name fidds,
4yCheckboes :
select mulliples options fo
Enable ses to
a list
It is a that an
gaplial tonporent ott (talse) state
-
be ether n on (hue) ßr
5 kadioBcttons :
llo sers to select one option trom a
cafcesnt
Set et uitually exclusive
TetAreai
alloos
’ IIt 1s a text cemponent that
tor editng a mutiple lires et tert
’ t fs a pat ot aa (uT) and it Ts
wers to
Used in appiatera to allow tet
rtevat ith o Viey thomuti-lino
a collocton oh iterns în a
Vetical o kogizotal listi.
’ H allow wseys to selec ono o more lines
54 fs a geneic tontaines that ca
othes tonpeneni
fowa the types oh poncls ae párasily
debemined
to them,
by the laycut marages
[chject|
Comçonent
7ChecKlon
choice
is t]
Contoine
wtndno Panel
Fone Díalog
* Event handing
proces of omanagfng
Ertohace) mterockicns , such as mouge Cia
sfincloo cctns oithin a
presses or
qraplical uses întertace. (GU).
3key tompenendy
tonpenerds ot vent
1 Event Sousce :
’The object that genuates, events
eL: Teuttor
Event cbject
?s
7 encapsulates ntormelien akout the everd.
er? cion Gent , OUse Event
3 Event istener:
’ -An intertece definíng mcthods to harde
specitie tyres o eventi
bclion Litener ,sMio tatener ,Keylitenl
Xxx Event
(
XxxListeney
SouTCe <<întetacey
(of XxxEvent)
Xxx vent
istenes List
addXxxlsteney htenes(s)
(is :Xoelistena) levert- hardlel)t
reDVe Xxxlisteney
(lis:Xxlisterey)
Mouse tnteod.
*hayfnnd Eventi
events occuu vohon ho user nteot
’heykonnd
woith the Such as presirg
Ezampe :
impost JoNO. Cuot.*;
impost jova . aut. event.*;
public class haylistenenuarple erderds frame
label l;
Tet rea aa
keystenes eample ( )
l= me labell);
aa0a = me Tett Ayea C)3
1.setBounds (20, so, l00, 20);
aaa. Set Bound (20,sO, 80, 30o)
ania.add eydistenen (tis);
add () ;
add(eca);
setsuo( 4D,40D);
setlauout (nu);
se<Vistble (tue)s
|-|Dx
Koy Peleased