java Programming Glossary: g2d.draw
Drawing a graphical histogram http://stackoverflow.com/questions/12518496/drawing-a-graphical-histogram g2d Graphics2D g.create g2d.setColor Color.DARK_GRAY g2d.drawRect xOffset yOffset width height int barWidth Math.max MIN_BAR_WIDTH.. barHeight g2d.fill bar g2d.setColor Color.DARK_GRAY g2d.draw bar xPos barWidth g2d.dispose share improve this answer..
Clicking on a drawn object http://stackoverflow.com/questions/12933592/clicking-on-a-drawn-object Graphics2D g2d Graphics2D grphcs for Shape s shapes g2d.draw s @Override public Dimension getPreferredSize return dim ..
How to make line animation smoother? http://stackoverflow.com/questions/13540534/how-to-make-line-animation-smoother backColor g2d.fill copyBounds g2d.setColor foreground g2d.draw copyBounds public static class DefaultAnimationModel implements..
Connect JButtons visually via line http://stackoverflow.com/questions/14804136/connect-jbuttons-visually-via-line group 0 .getWidth 2 endPoint.y group 1 .getHeight 2 g2d.draw new Line2D.Float startPoint endPoint g2d.dispose protected..
Rotate an image in java by the specified angle http://stackoverflow.com/questions/14884480/rotate-an-image-in-java-by-the-specified-angle Graphics2D g2d Graphics2D g.create g2d.setColor Color.RED g2d.drawLine getWidth 2 0 getWidth 2 getHeight g2d.drawLine 0 getHeight.. Color.RED g2d.drawLine getWidth 2 0 getWidth 2 getHeight g2d.drawLine 0 getHeight 2 getWidth getHeight 2 g2d.setColor Color.BLACK.. y rectangle.height 2 at.translate x y g2d.setTransform at g2d.draw rectangle g2d.dispose You might like to take a look at Transforming..
How to draw grid using swing class Java and detect mouse position when click and drag http://stackoverflow.com/questions/15421708/how-to-draw-grid-using-swing-class-java-and-detect-mouse-position-when-click-and cell g2d.setColor Color.GRAY for Rectangle cell cells g2d.draw cell g2d.dispose This example does resize the grid with the..
Line crosses Rectangle - how to find the cross points? http://stackoverflow.com/questions/15594424/line-crosses-rectangle-how-to-find-the-cross-points x y width height Graphics2D g2d Graphics2D g.create g2d.draw rect g2d.draw line g2d.setColor Color.RED Point2D ps getIntersectionPoint.. height Graphics2D g2d Graphics2D g.create g2d.draw rect g2d.draw line g2d.setColor Color.RED Point2D ps getIntersectionPoint..
Java make a directed line and make it move http://stackoverflow.com/questions/15607427/java-make-a-directed-line-and-make-it-move line new Line2D.Double startX startY endX endY g2d.draw line tx.setToIdentity double angle Math.atan2 line.y2 line.y1.. new BasicStroke 3 g2d.setColor Color.RED g2d.fill shape g2d.draw shape g2d.dispose public class PointyThing extends Path2D.Float.. g2d.setStroke new BasicStroke 3 g2d.setColor Color.RED g2d.draw new Line2D.Float mouseStart mouseEnd AffineTransform at new..
draw polar graph in java http://stackoverflow.com/questions/6694417/draw-polar-graph-in-java h Math.sin 4 t h path.lineTo x y g2d.setColor Color.blue g2d.draw path public static void main String args EventQueue.invokeLater..
Rotate a Java Graphics2D Rectangle? http://stackoverflow.com/questions/7517688/rotate-a-java-graphics2d-rectangle Color.WHITE Rectangle rect2 new Rectangle 100 100 20 20 g2d.draw rect2 g2d.fill rect2 public void actionPerformed ActionEvent.. 2 rect1.y rect1.height 2 g2d.rotate Math.toRadians 90 g2d.draw rect1 g2d.fill rect1 public void actionPerformed ActionEvent.. new Rectangle 100 100 20 20 g2d.rotate Math.toRadians 45 g2d.draw rect2 g2d.fill rect2 And btw you should override paintComponent..
Rounding Inaccuracies When Combining Areas in Java? http://stackoverflow.com/questions/9526835/rounding-inaccuracies-when-combining-areas-in-java Color.black for Line2D.Double line areaSegments g2d.draw line public static void main String args new AreaTest A successful..
|