Sabtu, 07 November 2015

JAVA (TRANSLASI)

Koding

import javax.swing.JFrame;
import javax.swing.JPanel;
public class franco extends JPanel {
  public void paint(Graphics g) {
    int x=100; int y=100;
    g.setColor (Color.red); //gambar asal
    g.draw3DRect (25, 10, 50, 75, true); //(titik kiri atas, lebar x, lebar y)
    g.setColor (Color.blue); //gambar hasil moving
    g.draw3DRect (25+x, 10+y, 50, 75, true); //pindah searah sumbu x dan y
 
    g.fillRect(x, y, 50,70 );
    g.clearRect(x, y, 50, 70);
  }
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new PindahMove());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(640, 480);
    frame.setVisible(true);
  }
}

Output


0 komentar:

Posting Komentar

luvne.com ayeey.com cicicookies.com mbepp.com kumpulanrumusnya.comnya.com tipscantiknya.com