Tes Frame bisa ditulis koding nya dengann 3 cara dibawah :
Satu
//berkas : TestFrame.java
import java.awt.*;
public class TestFrame{
public static void main (String [] args) {
Frame f = new Frame ("Program Test Frame");
f.setSize (300,300);
f.show();
}
}
Hasilnya
Dua
//berkas : TestFrame2.java
import java.awt.*;
public class TestFrame2 extends Frame {
public static void main (String [] args) {
TestFrame2 apl = new TestFrame2();
}
public TestFrame2 (){
super ("Test Frame 2");
setSize (300,100);
show();
}
}
Hasilnya
Tiga
//berkas : TestFrame3.java
import java.awt.*;
import java.awt.event.*;
public class TestFrame3 extends Frame {
public static void main (String [] args) {
TestFrame3 apl = new TestFrame3();
}
public TestFrame3 (){
super ("Test Frame 3");
setSize (300,100);
addWindowListener(
new TestFrame3.PenanganKejadian());
show();
}
class PenanganKejadian extends WindowAdapter {
public void windowClosing (WindowEvent e) {
System.exit(0);
}
}
}
Hasilnya
- Home
- Bahasa Assembly
- Gambar Teknik
- Sistem Operasi
- Interface
- CONTACTS
- Uncategorized
0 komentar:
Posting Komentar