Created
February 22, 2020 18:04
-
-
Save MinSomai/f2c9bf8e577ffaa22cbe3ffed449a9cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hw; | |
import java.awt.*; | |
import javax.swing.JPanel; | |
import javax.swing.JFrame; | |
public class ReflectionX13 extends JPanel { | |
int x1=100,y1=100,x2=290,y2=280,px1,px2,py1,py2; | |
public ReflectionX13() { | |
px1=y1; | |
px2=y2; | |
py1=x1; | |
py2=x2; | |
} | |
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 on X-axis: "); | |
frame.setVisible(true); | |
frame.setSize(500,500); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setContentPane(new ReflectionX13()); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment