Saturday, 1 February 2014
drag and drop
a = Shapes.AddEllipse(100,100)
b = Shapes.AddRectangle(100,100)
GraphicsWindow.MouseMove = mousemove
Sub mousemove
If GraphicsWindow.MouseX >= Shapes.GetLeft(b) then
If GraphicsWindow.MouseX <= Shapes.GetLeft(b) + 100 then
If GraphicsWindow.MouseY >= Shapes.GetTop(b) Then
If GraphicsWindow.MouseY <= Shapes.GetTop(b) + 100 then
While Mouse.IsLeftButtonDown
Shapes.move(b, GraphicsWindow.MouseX - 50, GraphicsWindow.MouseY - 50)
Endwhile
EndIf
EndIf
EndIf
endif
endsub
b = Shapes.AddRectangle(100,100)
GraphicsWindow.MouseMove = mousemove
Sub mousemove
If GraphicsWindow.MouseX >= Shapes.GetLeft(b) then
If GraphicsWindow.MouseX <= Shapes.GetLeft(b) + 100 then
If GraphicsWindow.MouseY >= Shapes.GetTop(b) Then
If GraphicsWindow.MouseY <= Shapes.GetTop(b) + 100 then
While Mouse.IsLeftButtonDown
Shapes.move(b, GraphicsWindow.MouseX - 50, GraphicsWindow.MouseY - 50)
Endwhile
EndIf
EndIf
EndIf
endif
endsub
1. Chapter1 - Installation and setup
Java development kit = compiler, virtual machine, and codes
package = nothing but folder
Chapter2 Notes
comment
- multiline: /*
- single line: //
printing a text
System.out.println("aloha");
concantenator = +
examples:
x = 10
System.out.println("aloha" + x);
mod: %
example: 5 % 2
IF
int x = 20;
int y = 20;
if (x < y){
System.out.println("x is less then y");
}
if (x == y){
System.out.println("x is equal to Y");
}
if (x > y){
System.out.println("x is bigger then y");
}
shorten that if
int x = 20;
int y = 20;
if (x < y) {
System.out.println("x is less then y");
}
else if (x == y)
shorten again:
Symbol:
x ++ itu sama dengan x = x+1 sama dengan x+=1
Switch-case
Contoh: pemilihan menu nasi goreng berdasarkan jenis hari.
nasigoreng = hari
Java development kit = compiler, virtual machine, and codes
package = nothing but folder
Chapter2 Notes
comment
- multiline: /*
- single line: //
printing a text
System.out.println("aloha");
concantenator = +
examples:
x = 10
System.out.println("aloha" + x);
mod: %
example: 5 % 2
IF
int x = 20;
int y = 20;
if (x < y){
System.out.println("x is less then y");
}
if (x == y){
System.out.println("x is equal to Y");
}
if (x > y){
System.out.println("x is bigger then y");
}
shorten that if
int x = 20;
int y = 20;
if (x < y) {
System.out.println("x is less then y");
}
else if (x == y)
shorten again:
Symbol:
x ++ itu sama dengan x = x+1 sama dengan x+=1
Switch-case
Contoh: pemilihan menu nasi goreng berdasarkan jenis hari.
nasigoreng = hari
Java
If, if-else
for, while, do-while, for-each
arrays
string manipulation, wrapper classes
data types and operators
Chapter3
Class, object
data and methods
method signature
this keyword
constructor
Chapter4
Object oriented-programming
What makes a language OOP?
encapsulation and data hiding
getter and setter
polymorphism, overloading
Chapter 5 review
Chapter6
Inheritance
abstract classes
interfaces
super keywor
overriding
Chapter7
Collections
List, arraylist
Hashmap
Generics
Chapter 8
Exceptions
try-catch-finally
throw and throws
Chapter9
Final, static
Final keyword
Static keyword
Variable arguments
for, while, do-while, for-each
arrays
string manipulation, wrapper classes
data types and operators
Chapter3
Class, object
data and methods
method signature
this keyword
constructor
Chapter4
Object oriented-programming
What makes a language OOP?
encapsulation and data hiding
getter and setter
polymorphism, overloading
Chapter 5 review
Chapter6
Inheritance
abstract classes
interfaces
super keywor
overriding
Chapter7
Collections
List, arraylist
Hashmap
Generics
Chapter 8
Exceptions
try-catch-finally
throw and throws
Chapter9
Final, static
Final keyword
Static keyword
Variable arguments
Friday, 31 January 2014
Drag and Drop
a = Shapes.AddEllipse(100,100)
GraphicsWindow.MouseMove = mousemove
Sub mousemove
While Mouse.IsLeftButtonDown
Shapes.move(a, GraphicsWindow.MouseX, GraphicsWindow.MouseY)
Endwhile
endsub
GraphicsWindow.MouseMove = mousemove
Sub mousemove
While Mouse.IsLeftButtonDown
Shapes.move(a, GraphicsWindow.MouseX, GraphicsWindow.MouseY)
Endwhile
endsub
ketika dua event berjibaku
gw pengen discover: apakah suatu eksekusi suatu event bisa di interupsi oleh eksekusi event lain?
GraphicsWindow.Show()
GraphicsWindow.MouseDown = mousedown
GraphicsWindow.KeyDown = keydown
Sub keydown
TextWindow.WriteLine("aloha")
EndSub
Sub mousedown
TextWindow.BackgroundColor = "red"
For i = 0 To 100000
TextWindow.WriteLine(i)
EndFor
EndSub
diatas kmu bisa lihat bahwa ketika gw klik mouse diatas jendela grafik, program akan mulai menampilkan angka di jendela text (textwindow), angka ini gw perbanyak dari 0 sampai seratus ribu, untuk memperlama waktu eksekusi sub procedure mousedown. Ditengah eksekusi sub procedure mousedown ini, misalkan ketika angka baru sampai angka 10000, 10001, gw tekan sembarang tombol pada keyboard, dengan tujuan mengintrupsi proses perlakuan sub procedure mousedown diatas, tapi gw tidak melihat adanya tampilan kata aloha, yang gw lihat hanya penerusan angka-angka tersebut.
Setelah angka 100000 lah gw baru melihat kata aloha diatas. Dari pengujian ini gw bisa melihat bahwa yang pengintrupsian subprocedure tidak bisa dilakuka.
Gambar biar gw jangan dibilang hoax:
GraphicsWindow.Show()
GraphicsWindow.MouseDown = mousedown
GraphicsWindow.KeyDown = keydown
Sub keydown
TextWindow.WriteLine("aloha")
EndSub
Sub mousedown
TextWindow.BackgroundColor = "red"
For i = 0 To 100000
TextWindow.WriteLine(i)
EndFor
EndSub
diatas kmu bisa lihat bahwa ketika gw klik mouse diatas jendela grafik, program akan mulai menampilkan angka di jendela text (textwindow), angka ini gw perbanyak dari 0 sampai seratus ribu, untuk memperlama waktu eksekusi sub procedure mousedown. Ditengah eksekusi sub procedure mousedown ini, misalkan ketika angka baru sampai angka 10000, 10001, gw tekan sembarang tombol pada keyboard, dengan tujuan mengintrupsi proses perlakuan sub procedure mousedown diatas, tapi gw tidak melihat adanya tampilan kata aloha, yang gw lihat hanya penerusan angka-angka tersebut.
Setelah angka 100000 lah gw baru melihat kata aloha diatas. Dari pengujian ini gw bisa melihat bahwa yang pengintrupsian subprocedure tidak bisa dilakuka.
Gambar biar gw jangan dibilang hoax:
Subscribe to:
Comments (Atom)