Skip to content

Instantly share code, notes, and snippets.

@MinSomai
Created February 22, 2020 18:14
Show Gist options
  • Save MinSomai/12b42a985d75c10f056a7b94903518fa to your computer and use it in GitHub Desktop.
Save MinSomai/12b42a985d75c10f056a7b94903518fa to your computer and use it in GitHub Desktop.
package hw;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JFrame;
public class ReflectionOrigin13 extends JPanel {
int x1=10,y1=10,x2=70,y2=70,px1,px2,py1,py2;
public ReflectionOrigin13() {
px1= -x1+360;
px2= -x2+360;
py1= -y1+360;
py2= -y2+360;
}
public void paint(Graphics g) {
g.drawLine(x1,y1,x2,y2);
g.drawLine(px1, py1, px2, py2);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setTitle("Reflection (Origin): ");
frame.setVisible(true);
frame.setSize(600,600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new ReflectionOrigin13());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment