Вы находитесь на странице: 1из 5

Robot()

http://www.learningwithrobots.com/doc/becker/robots/Robot.html
http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html
http://ascielish.wordpress.com/2008//2!/t"torial#cara#memb"at#robot#cerdas/
public class Robot
extends Object
$his class is "sed to generate native s%stem inp"t events &or the p"rposes o& test a"tomation'
sel&#r"nning demos' and other applications where control o& the mo"se and ke%board is
needed. $he primar% p"rpose o& Robot is to &acilitate a"tomated testing o& (ava plat&orm
implementations. )sing the class to generate inp"t events di&&ers &rom posting events to the
*+$ event ,"e"e or *+$ components in that the events are generated in the plat&orm-s
native inp"t ,"e"e. .or e/ample' Robot.mo"se0ove will act"all% move the mo"se c"rsor
instead o& j"st generating mo"se move events. 1ote that some plat&orms re,"ire special
privileges or e/tensions to access low#level inp"t control. 2& the c"rrent plat&orm
con&ig"ration does not allow inp"t control' an *+$3/ception will be thrown when tr%ing to
constr"ct Robot objects. .or e/ample' 4#+indow s%stems will throw the e/ception i& the
4$35$ 2.2 standard e/tension is not s"pported (or not enabled) b% the 4 server. *pplications
that "se Robot &or p"rposes other than sel&#testing sho"ld handle these error conditions
grace&"ll%.
6elas ini dig"nakan "nt"k menghasilkan peristiwa sistem inp"t asli "nt"k keperl"an
otomatisasi tes ' demo diri berjalan ' dan aplikasi lain di mana kontrol mo"se dan ke%board
%ang dib"t"hkan. $"j"an "tama dari Robot adalah "nt"k mem&asilitasi peng"jian otomatis
dari implementasi plat&orm (ava.
0engg"nakan kelas "nt"k menghasilkan peristiwa inp"t berbeda dari posting acara ke acara
antrian *+$ ata" komponen *+$ dalam peristiwa %ang dihasilkan dalam antrian mas"kan
asli plat&orm. 5ebagai contoh' Robot.mo"se0ove benar#benar akan memindahkan k"rsor
mo"se b"kan han%a menghasilkan peristiwa mo"se bergerak.
7erhatikan bahwa beberapa plat&orm memerl"kan hak kh"s"s ata" ekstensi "nt"k mengakses
kontrol inp"t tingkat rendah. (ika kon&ig"rasi plat&orm %ang saat ini tidak mem"ngkinkan
kontrol inp"t' seb"ah *+$3/ception akan dilemparkan ketika mencoba "nt"k membang"n
objek Robot. 5ebagai contoh' sistem 4#+indow akan melemparkan pengec"alian jika
4$35$ 2.2 ekstensi standar tidak did"k"ng ( ata" tidak diakti&kan ) oleh server 4.
*plikasi %ang mengg"nakan Robot "nt"k t"j"an selain diri # peng"jian har"s menangani
kondisi kesalahan angg"n.
5creen 8apt"re()
http://www.java2s.com/$"torial/(ava/0280995+$/."ll5creen8apt"re.htm
http://stackover&low.com/,"estions/00:208!/screen#capt"re#in#java#not#
capt"ring#whole#screen
http://www.javaworld.com/article/2077;;/learn#java/capt"re#the#screen.html
public BufferedImage createScreenCapture(Rectangle screenRect)
Creates an image containing pixels read from the screen. This image does not
include the mouse cursor.
Parameters:
screenRect - Rect to capture in screen coordinates
Returns:
The captured image
Throws:
IllegalArgumentException - if screenRect width and height are not greater
than zero
SecurityException - if readisplay!ixels permission is not granted
See Also:
Security"anager#c$ec%!ermission(ja&a#security#!ermission),
A'(!ermission
5ocket *ccept()
komp"tasi.&iles.wordpress.com/200/0/netprog200#0<.pd&
http://java.l%racc.com/belajar/java#"nt"k#pem"la/soket#klien#dan#server
http://docs.oracle.com/javase/t"torial/networking/sockets/client5erver.html
public class Ser&erSoc%et
extends Object
implements Closeable
$his class implements server sockets. * server socket waits &or re,"ests to come in over the
network. 2t per&orms some operation based on that re,"est' and then possibl% ret"rns a res"lt
to the re,"ester. $he act"al work o& the server socket is per&ormed b% an instance o& the
5ocket2mpl class. *n application can change the socket &actor% that creates the socket
implementation to con&ig"re itsel& to create sockets appropriate to the local &irewall.
6elas ini mengimplementasikan soket server. 5eb"ah server soket men"ngg" permintaan
mas"k melal"i jaringan. 2a melak"kan beberapa operasi berdasarkan permintaan it"' dan
kem"dian m"ngkin mengembalikan hasiln%a kepada pemohon. 7ekerjaan %ang sebenarn%a
dari socket server dilak"kan oleh seb"ah instance dari kelas 5ocket2mpl. 5eb"ah aplikasi
dapat meng"bah pabrik soket %ang menciptakan implementasi socket "nt"k mengkon&ig"rasi
dirin%a sendiri "nt"k memb"at soket %ang ses"ai dengan &irewall lokal.
* socket is one endpoint o& a two#wa% comm"nication link between two programs r"nning on
the network. * socket is bo"nd to a port n"mber so that the $87 la%er can identi&% the
application that data is destined to be sent to. *n endpoint is a combination o& an 27 address
and a port n"mber. 3ver% $87 connection can be "ni,"el% identi&ied b% its two endpoints.
$hat wa% %o" can have m"ltiple connections between %o"r host and the server.
5ocket adalah salah sat" endpoint dari link kom"nikasi d"a arah antara d"a program %ang
berjalan pada jaringan. 5eb"ah socket terikat dengan nomor port sehingga lapisan $87 dapat
mengidenti&ikasi aplikasi bahwa data ditakdirkan "nt"k dikirim ke.
5eb"ah endpoint adalah kombinasi dari seb"ah alamat 27 dan nomor port. 5etiap koneksi
$87 dapat diidenti&ikasi secara "nik oleh d"a titik "j"ngn%a. =engan cara it" *nda dapat
memiliki beberapa samb"ngan antara host dan server.
0"lticast()
http://void#mainblog.blogspot.com/20:90<909archive.html
http://nickadja.blogspot.com/200//translate#paket#java#librar%92.html
public class MulticastSocket
extends atagramSoc%et
The multicast datagram socet class is useful for sending and recei!ing "P
multicast pacets. A #ulticastSocet is a $%&P' &atagramSocet, with additional
capa(ilities for )oining *groups* of other multicast hosts on the internet.
* m"lticast gro"p is speci&ied b% a class = 27 address and b% a standard )=7 port n"mber.
8lass = 27 addresses are in the range ))*#+#+#+ to ),-#)..#)..#)..' incl"sive. $he
address 22:.0.0.0 is reserved and sho"ld not be "sed.
>ne wo"ld join a m"lticast gro"p b% &irst creating a 0"lticast5ocket with the desired port'
then invoking the join/roup(InetAddress groupAddr) method:
00 join a "ulticast group and send t$e group salutations
###
String msg 1 23ello24
InetAddress group 1 InetAddress#getBy5ame(2))6#.#7#82)4
"ulticastSoc%et s 1 ne9 "ulticastSoc%et(786-)4
s#join/roup(group)4
atagram!ac%et $i 1 ne9 atagram!ac%et(msg#getBytes(): msg#lengt$():
group: 786-)4
s#send($i)4
00 get t$eir responses;
byte<= buf 1 ne9 byte<>+++=4
atagram!ac%et rec& 1 ne9 atagram!ac%et(buf: buf#lengt$)4
s#recei&e(rec&)4
###
00 O?: I@m done tal%ing A lea&e t$e group###
s#lea&e/roup(group)4
$he m"lticast kelas socket datagram berg"na "nt"k mengirim dan menerima paket 27
m"lticast. 5eb"ah 0"lticast5ocket adalah ()=7) =atagram5ocket' dengan kemamp"an
tambahan "nt"k bergab"ng dengan ?kelompok? host m"lticast lainn%a di internet.
5eb"ah kelompok m"lticast ditent"kan oleh alamat 27 kelas = dan oleh nomor port )=7
standar. *lamat 27 6elas = berada di kisaran 22:.0.0.0 sampai 2<@.2;;.2;;.2;;' inkl"si&.
*lamat 22:.0.0.0 dicadangkan dan tidak boleh dig"nakan. 5at" akan bergab"ng dengan
kelompok m"lticast dengan terlebih dah"l" menciptakan seb"ah 0"lticast5ocket dengan port
%ang diinginkan' kem"dian memanggil metode joinAro"p (2net*ddress gro"p*ddr):
Remote 0ethod 2nvocation
http://www.academia.ed"/:<822/(*B*9R02
http://docs.oracle.com/javase/t"torial/rmi/
http://aditiapikarin.blogspot.com/20</0</remote#method#invocation#rmi.html
http://p%ia.wordpress.com/202/0/08/rmi#remote#method#invocation#dan#rpc#
remote#proced"re#call/
R02 applications o&ten comprise two separate programs' a server and a client. * t%pical
server program creates some remote objects' makes re&erences to these objects accessible'
and waits &or clients to invoke methods on these objects. * t%pical client program obtains a
remote re&erence to one or more remote objects on a server and then invokes methods on
them. R02 provides the mechanism b% which the server and the client comm"nicate and pass
in&ormation back and &orth. 5"ch an application is sometimes re&erred to as a distrib"ted
object application.
*plikasi R02 sering terdiri dari d"a program terpisah' server dan client. 5eb"ah program
server biasa menciptakan beberapa objek remote' memb"at re&erensi ke ob%ek ini dapat
diakses' dan men"ngg" klien "nt"k memanggil metode pada objek terseb"t. 5eb"ah program
klien khas memperoleh re&erensi remote "nt"k sat" ata" lebih objek remote di server dan
kem"dian memanggil metode pada mereka. R02 men%ediakan mekanisme dimana server dan
client berkom"nikasi dan men%ampaikan in&ormasi bolak#balik. *plikasi terseb"t kadang#
kadang diseb"t sebagai aplikasi objek terdistrib"si.
7engiriman melal"i 5ocket
http://p"tra#ag"stian.blogspot.com/202/0;/pengiriman#data#dengan#
socket.html
http://lokerberbagi.blogspot.com/20:/02/clientserver#comp"ting#
mengg"nakan#java.html
http://m%comp"tererror.blogspot.com/20</0</t"torial#aplikasi#client#
server.html
http://haviC"lkarnain.blogspot.com/202/0;/pengiriman#object#melal"i#socket#
client.html
$"torial 1etbeans
http://wos#link.blogspot.com/20/0/netbeans#70#"nt"k#pemrograman#
java.html