Top "Graphics2d" questions

Graphics2D is the part of the Java 2D API related to two-dimensional graphics, text, and imaging capabilities.

Getting string size in java (without having a Graphics object available)

I'm trying to write application which need to draw many strings using Graphics2D class in Java. I need to …

java string bounds graphics2d
How do I draw graphics to PDF using iText?

I am trying to complete an example that draws graphics and writes them to PDF, but I keep getting errors …

java spring-mvc pdf-generation itext graphics2d
Java: Getting a font with a specific height in pixels

It’s easy to determine the rendered height of a font using FontMetrics, but what about the other way around? …

java fonts graphics2d fontmetrics
Rotate a buffered image in Java

I am trying to rotate a buffered image in java. Here is the code I am using: public static BufferedImage …

java rotation bufferedimage graphics2d
How do I copy part of one image to another?

I want to copy part of one image into another smaller one: in other words, copy a subrectangle. I have …

java image graphics graphics2d image-clipping
using repaint() method with actionPerformed

How to use the repaint() method when a button is pressed and Graphics p has to re-paint everything from scratch? …

java swing repaint graphics2d japplet
Clear a transparent BufferedImage as fast as possible

I have a transparent BufferedImage created with the following code(not relevant how it is created, I think): GraphicsEnvironment ge = …

java awt bufferedimage graphics2d
Java: Detecting image format, resize (scale) and save as JPEG

This is the code I have, it actually works, not perfectly but it does, the problem is that the resized …

java image resize javax.imageio graphics2d
Java - Draw text in the center of an image

I need to write text in the center of an image. The text to write is not always the same. …

java swing graphics graphics2d imageicon
Repaint() not calling paint() in Java

Let me start off by saying I know I've violated some basic Java principles in this messy code, but I'm …

java swing jpanel repaint graphics2d