Skip to content

Instantly share code, notes, and snippets.

@MinSomai
Created February 22, 2020 18:10
Show Gist options
  • Save MinSomai/fc6758c241da2fcd7b965af1008c21ab to your computer and use it in GitHub Desktop.
Save MinSomai/fc6758c241da2fcd7b965af1008c21ab to your computer and use it in GitHub Desktop.
package hw;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
public class ReflectionY13 extends Applet{
int x1 = 50;
int y1 = 50;
int x2 = 100;
int y2 = 100;
int px1,px2,py1,py2;
public void paint(Graphics g) {
px1=-x1;
px2=-x2;
py1 = y1;
py2 = y2;
g.drawLine(x1+100, y1, x2+100, y2);
g.drawString("before reflection", x2+100, y2);
g.setColor(Color.BLACK);
g.drawString("after reflection on y-axis", px2 + 150, py2);
g.drawLine(px1+150, py1, px2+150, py2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment