Created
February 22, 2020 18:51
-
-
Save MinSomai/6b6a2f2ed84bd1d2bacefa506550e6d5 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 ShearingXY13 extends JPanel{ | |
int x1=60 ,y1=60, x2=70,y2=70, shx=1, shy=3, a,b,c,d; | |
public ShearingXY13() { | |
a=x1+shx*y1; | |
b=y1+shy*x1; | |
c=x2+shx*y2; | |
d=y2+shy*x2; | |
} | |
public void paint(Graphics g) { | |
g.drawLine(x1, y1, x2, y2); | |
g.drawLine(a, b, c, d); | |
} | |
public static void main(String[] args) { | |
JFrame frame = new JFrame(); | |
frame.setTitle("Shearing on Both Direction: "); | |
frame.setVisible(true); | |
frame.setSize(600,650); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setContentPane(new ShearingXY13()); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment