{"id":26894,"date":"2021-05-04T23:10:06","date_gmt":"2021-05-05T03:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/shearexample-java-illustrates-the-effect-of-applying-a-shear-transformation-prior-to-drawing-a-square-programming-code-examples-java-j2ee-j2me-drawing\/"},"modified":"2021-05-04T23:10:06","modified_gmt":"2021-05-05T03:10:06","slug":"shearexample-java-illustrates-the-effect-of-applying-a-shear-transformation-prior-to-drawing-a-square-programming-code-examples-java-j2ee-j2me-drawing","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26894","title":{"rendered":"ShearExample.java. Illustrates the effect of applying a shear transformation prior to drawing a square #Programming Code Examples #Java\/J2EE\/J2ME #Drawing"},"content":{"rendered":"<pre>\nimport javax.swing.*;\nimport java.awt.*;\nimport java.awt.geom.*;\n\n\/** An example of shear transformations on a rectangle. \n *\n ***********************\n\npublic class ShearExample extends JPanel {\n  private static int gap=10, width=100;\n  private Rectangle rect = new Rectangle(gap, gap, 100, 100);\n\n  public void paintComponent(Graphics g) {\n    super.paintComponent(g);\n    Graphics2D g2d = (Graphics2D)g;\n    for (int i=0; i&lt;5; i++) {\n      g2d.setPaint(Color.red);\n      g2d.fill(rect);\n      \/\/ Each new square gets 0.2 more x shear.\n      g2d.shear(0.2, 0.0);\n      g2d.translate(2*gap + width, 0);\n    }\n  }\n\n  public static void main(String[] args) {\n    String title =\n      &quot;Shear: x shear ranges from 0.0 for the leftmost&quot; +\n      &quot;'square' to 0.8 for the rightmost one.&quot;;\n    WindowUtilities.openInJFrame(new ShearExample(),\n                                 20*gap + 5*width, \n                                 5*gap + width,\n                                 title);\n  }\n}\n<\/pre>\n<pre>\r\n\r\nNote: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017<\/pre>\n<p> From: http:\/\/sitestree.com\/?p=10381<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Drawing<br \/>Tags:Java\/J2EE\/J2MEDrawing<br \/> Post Data:2017-01-02 16:04:39<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>import javax.swing.*; import java.awt.*; import java.awt.geom.*; \/** An example of shear transformations on a rectangle. * *********************** public class ShearExample extends JPanel { private static int gap=10, width=100; private Rectangle rect = new Rectangle(gap, gap, 100, 100); public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; for (int i=0; i&lt;5; i++) { g2d.setPaint(Color.red); g2d.fill(rect); &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26894\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-26894","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10417,"url":"http:\/\/bangla.sitestree.com\/?p=10417","url_meta":{"origin":26894,"position":0},"title":"ShearExample.java. Illustrates the effect of applying a shear transformation prior to drawing a square","author":"","date":"August 28, 2015","format":false,"excerpt":"import javax.swing.*; import java.awt.*; import java.awt.geom.*; \/** An example of shear transformations on a rectangle. \u00a0* \u00a0*********************** public class ShearExample extends JPanel { \u00a0 private static int gap=10, width=100; \u00a0 private Rectangle rect = new Rectangle(gap, gap, 100, 100); \u00a0 public void paintComponent(Graphics g) { \u00a0\u00a0\u00a0 super.paintComponent(g); \u00a0\u00a0\u00a0 Graphics2D g2d\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10404,"url":"http:\/\/bangla.sitestree.com\/?p=10404","url_meta":{"origin":26894,"position":1},"title":"Illustrates the effect of different transparency","author":"","date":"August 28, 2015","format":false,"excerpt":"~~~~~~~~~~~~~~~~~~~ TransparencyExample.java Illustrates the effect of different transparency (alpha) values when drawing a shape. ~~~~~~~~~~~~~~~~~~~ import javax.swing.*; import java.awt.*; import java.awt.geom.*; \/** An illustration of the use of AlphaComposite to make \u00a0*\u00a0 partially transparent drawings. \u00a0* \u00a0********************************** public class TransparencyExample extends JPanel { \u00a0 private static int gap=10, width=60, offset=20,\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26882,"url":"http:\/\/bangla.sitestree.com\/?p=26882","url_meta":{"origin":26894,"position":2},"title":"Illustrates the effect of different transparency #Programming Code Examples #Java\/J2EE\/J2ME #Drawing","author":"Author-Check- Article-or-Video","date":"May 4, 2021","format":false,"excerpt":"~~~~~~~~~~~~~~~~~~~ TransparencyExample.java Illustrates the effect of different transparency (alpha) values when drawing a shape. ~~~~~~~~~~~~~~~~~~~ import javax.swing.*; import java.awt.*; import java.awt.geom.*; \/** An illustration of the use of AlphaComposite to make * partially transparent drawings. * ********************************** public class TransparencyExample extends JPanel { private static int gap=10, width=60, offset=20, deltaX=gap+width+offset;\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10402,"url":"http:\/\/bangla.sitestree.com\/?p=10402","url_meta":{"origin":26894,"position":3},"title":"Demonstrates using a TexturePaint to fill an shape with a tiled image","author":"","date":"August 28, 2015","format":false,"excerpt":"^^^^^^^^^^^^^^^^^ TiledImages.java Demonstrates using a TexturePaint to fill an shape with a tiled image. Uses the following class and images: \u00a0\u00a0\u00a0 * ImageUtilities.java Simplifies creating a BufferedImage from an image file. ~~~~~~~~~~~~~~~~~~ import javax.swing.*; import java.awt.*; import java.awt.geom.*; import java.awt.image.*; \/** An example of using TexturePaint to fill objects with\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26880,"url":"http:\/\/bangla.sitestree.com\/?p=26880","url_meta":{"origin":26894,"position":4},"title":"Demonstrates using a TexturePaint to fill an shape with a tiled image #Programming Code Examples #Java\/J2EE\/J2ME #Drawing","author":"Author-Check- Article-or-Video","date":"May 4, 2021","format":false,"excerpt":"^^^^^^^^^^^^^^^^^ TiledImages.java Demonstrates using a TexturePaint to fill an shape with a tiled image. Uses the following class and images: * ImageUtilities.java Simplifies creating a BufferedImage from an image file. ~~~~~~~~~~~~~~~~~~ import javax.swing.*; import java.awt.*; import java.awt.geom.*; import java.awt.image.*; \/** An example of using TexturePaint to fill objects with tiled\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10271,"url":"http:\/\/bangla.sitestree.com\/?p=10271","url_meta":{"origin":26894,"position":5},"title":"Printing in Java 2","author":"","date":"August 26, 2015","format":false,"excerpt":"\u00a0\u00a0 * \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 o PrintExample.java Demonstrates printing a Graphics2D object. import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.print.*; \/** An example of a printable window in Java 1.2. The key point \u00a0*\u00a0 here is that any component is printable in Java 1.2. \u00a0*\u00a0 However, you have to be careful to\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26894"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26894\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26894"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}