About 10,300,000 results
Open links in new tab
  1. How does the Graphics Class in Java work? - Stack Overflow

    Aug 4, 2012 · Recently, I have been trying to do some Java work with graphics. Now the Graphics class is abstract, meaning it itself cannot be instantiated but a subclass of it might be able to …

  2. java - Java2D: Increase the line width - Stack Overflow

    May 15, 2010 · I want to increase the Line2D width. I could not find any method to do that. Do I need to actually make a small rectangle for this purpose?

  3. Best API for simple 2D graphics with Java - Stack Overflow

    Jan 28, 2016 · Java 2D (Graphics2D and friends) is indeed the best choice that I know of. Swing is actually implemented on top of Java 2D, so yes, if you want non-GUI-type graphics, Java 2D …

  4. How do I initialize a Graphics object in Java? - Stack Overflow

    Oct 18, 2015 · You dont initialize a Graphics object. You get the graphics object from a component via Component#getGraphics() method. In your particular case I think repaint() is all …

  5. coordinates - How to draw lines in Java - Stack Overflow

    Apr 27, 2011 · I'm wondering if there's a funciton in Java that can draw a line from the coordinates (x1, x2) to (y1, y2)? What I want is to do something like this: drawLine(x1, x2, x3, x4); And I …

  6. How to Change Font Size in drawString Java - Stack Overflow

    Aug 15, 2013 · The answer below is mostly right. Start with the question slightly reworded. How do I change the font size of a g or g2d drawstring object? First create your g (or g2d) …

  7. swing - Drawing in Java using Canvas - Stack Overflow

    Mar 8, 2012 · Suggestions: Don't use Canvas as you shouldn't mix AWT with Swing components unnecessarily. Instead use a JPanel or JComponent. Don't get your Graphics object by calling …

  8. Java: basic plotting, drawing a point/dot/pixel - Stack Overflow

    Feb 13, 2013 · Unfortunately java does not have any method for drawing a single point, instead you have to use drawLine with a same point for both start & end.

  9. How to add RGB values into setColor() in Java? - Stack Overflow

    How to add RGB values into setColor () in Java? Asked 8 years, 9 months ago Modified 4 years, 6 months ago Viewed 176k times

  10. swing - Rotate a Java Graphics2D Rectangle? - Stack Overflow

    Sep 22, 2011 · public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; g2d.setColor(Color.WHITE); Rectangle rect2 = new Rectangle(100, …