JAVA APPLETS
•
Tổng quan về Applet
•
Cài đặt một Applet trong trang web
•
Các thành phần trong AWT.
•
Giới hạn của Applet
!"#$%
&%'#(#)*+, /0#1$
/213425/.60#
789,3425:
!"#
#;4!<&$%
=>#;4/./?9#2/@%9ABC$.#2"4
AB'=335D##+.E425
javac –encoding utf-8 HelloWorld.java
<>,5F)*1425GHIJK21L6.3,M
$%&"
NOPQ/6,O%E,R
A:$%STF1$/
java.lang.Object
java.awt.Component
java.awt.Container
java.applet.Applet
'(
•
/UVWXGQS,
)*+",-
K
Vẽ Applet
stop( )
Bắt đầu
start( ) paint( )
Applet đang làm
việc
Applet được sinh
ra
Applet được hiển thị
Applet nghỉ và chờ
Applet bị phá
hủy
Khởi tạo
destroy( )
Hủy
init( )
Dừng
./"01#""123",
=3,YTYZE?#2QF[Q%\/,>%ST
%ST
•
init() N]QF,%^@/ ZWQ
•
start() *_,L,W%.%\@
`#T
•
stop() AVT,WQ%%\@,$#+.E
•
destroy() ZERaG45QYb
4/"
$%&"
0%ST56/#%ST@,335#
•
567%ST35S46%\Y@paint() ,343
cY,W+#2#"4
•
567/%ST@ZEpaint() (/`E
d6C
QP%]Y%ST/.PX8
QeP%]Y%STfZE%click chuột, rê chuột, thảg
#X9hW8
0:8
•
8iAbstract WindowingToolkitj
–
&/ 4 % E 1 9 k #+ "; #P %^ @ ,3 Z E
%\@iGUIj
–
A V ,L. ,W Y ,D %^ L O ,3 _ l / 2 T 9
";LV
–
AY/LE,R(#$;<=
./">?",8
.@>!A
•
.&/,D%^@,3T,ZY,D%^Y)#P
A
•
!A /,D%^,%^@,3,f3vị trí /kích
thước WY/L42#,D%^A#
•
9@7AY/L$3kYZEP/4/?
B@/""/"!A
•
*##&.
•
I;&.
•
A#&.
•
m#&.
•
m#*&.
C!A
•
BorderLayout/Y_OY/L,%\fWTF
$nZ,335
–
0Qmop7QqiNOUTHj
–
0Qmopo)riSOUTHj
–
&s)op7QqiWESTj
–
&s)opo)riEASTj
–
Ao)oqiCENTERj
=!A
•
= /.>,5QF,S6/,>Y/L#2@eP
#Y6Ff/1,W+,D%^tOC,%^,>]/%XAY
f>,5/canh giữa
•
A$3,>TPP#Y6.%^4(%ST
setComponentOrientaon
.!A
•
AY,D%^,%^,>P>XT/(2%Y
Y4/)%k.:V.,%^,D%^AY,D%^Y(42
%XC45V
D!A
•
%X1+XY14(AY,D%^C,>PY1
,$TZ_Oh/P#Yd6FP#2D
DC!A
•
= /Y#+4/..3.3uhc 3LVAY,D%^#
Th,%^,%/%X%SZm#&.%?%XY
,D%^1VO6P?Z#2@.RGridBagConstraint
./"E2>AF5G!!!A6
•
NY9Y#+4/./.F6/V64(.PE,55#?R,?
Y#2/+,D%^
•
=3Y9Y#+4/./.@
setLayout(null)
•
AY/%\@
public void setLocation(Point p)
public void setSize(Dimension d)
public void setBounds(Rectangle r)
./"01#""
rLOY/L,f,%^UVPX/component2B,f$
u%ST,%^OOvPXcomponentr%X, /Y%S
public void setBackground(Color c)=>/f
public Color getBackground(Color c)&V./f
public void setForeground(Color c)=>/u
public Color getForeground(Color c)&V./u
public void setVisible(boolean isShowed)wE,D%^
./"01#""
public void setFont(Font f).,Mx35Y,D%^iTextField, TextArea, Bu#on,
CheckboxFgj
public Font getFont()&V.yxW,D%^
public FontMetrics getFontMetrics(Font f): &V.1tf?%XW,D%^x,,%^
89
public Component getComponentAt(Point P): +,D%^]R,iF.j#T
A#
public void setEnabled(): z4k{>z_{
public void repaint(): kk
public void update(Graphics g): ,%^Rd#ij
./"@F4:"
AY|D.YZEVYPXA,L/uZE
public void addComponentListener(ComponentListener l)
}8'YZE,D%^.,Mf?%XFE#.G,%%ST~4ij
public void addFocusListener(FocusListener l)
public void addKeyListener(KeyListener l)
public void addMouseListener(MouseListener l)
public void addMouseMotionListener(MouseMotionListener l)