NIM : 11110120
Tugaz grafika komputer semster 5,STIKOM ARTHA BUANA KUPANG,
Tugas ini dibuat dengan menggunakan program java Neatbeans IDE 7.0.1.dibawah ini adalah lisning dan hasinlnya.
========================================================================
LISNINGNYA:
package VITA_MAU;
import java.awt.*;
import java.awt.event.*;
public class MEMBUAT_OTO extends
Frame implements ActionListener{
int x = 100;
int y = 100;
public static void main(String[]
args) {
Frame frame = new MEMBUAT_OTO();
frame.setSize(640, 480);
frame.setVisible(true);
}
public MEMBUAT_OTO() {
setTitle("MEMBUAT_OTO");
// create menu
.................... STIKOM ARTHA BUANA
MenuBar mb = new MenuBar();
setMenuBar(mb);
Menu menu = new Menu("File");
mb.add(menu);
MenuItem mi = new
MenuItem("Exit");
mi.addActionListener(this);
menu.add(mi);
// end program when window is
closed
WindowListener l = new WindowAdapter() {
@Override
public void windowClosing(WindowEvent ev) {
System.exit(0);
}
};
this.addWindowListener(l);
// mouse event
handler....................STIKOM ARTHA BUANA
MouseListener mouseListener = new
MouseAdapter() {
public void
mouseClicked(MouseEvent ev) {
x = ev.getX();
y = ev.getY();
repaint();
}
};
addMouseListener(mouseListener);
}
@Override
public void paint(Graphics g) {
g.setColor(Color.black);
g.drawRect(200, 149, 100, 100);
g.setColor(Color.red);
g.fillRect(239, 200,60, 49);
g.setColor(Color.red);
g.fillRect(300,125,300,125);
//g.drawRect(x, y, WIDTH, WIDTH)
g.setColor(Color.black);
g.fillOval(275, 240, 40, 40);
g.fillOval(515, 240, 40, 40);
g.fillOval(400, 240, 40, 40);
g.drawRect(195, 200, 5, 35);
g.setColor(Color.orange);
g.fillOval(190, 210, 10,10);
}
@Override
public void
actionPerformed(ActionEvent ev) {
String command =
ev.getActionCommand();
if
("Exit".equals(command)) {
System.exit(0);
//********* NAMA : YOVITA MAU
//********* NIM :
11110120
}
}
}
========================================================================
HASILNYA setelah di run
==============================THANKS=================================
Tidak ada komentar:
Posting Komentar