Java 2D Drawing Optimal Performance

A synthesis of the answers to this post, the answers to Consty’s, and my own research: What works: Use GraphicsConfiguration.createCompatibleImage to create images compatible with what you’re drawing on. This is absolutely essential! Use double-buffered drawing via Canvas.createBufferStrategy. Use -Dsun.java2d.opengl=True where available to speed up drawing. Avoid using transforms for scaling. Instead, cache scaled versions … Read more

Java2D Performance Issues

I think I found a solution by researching and putting bits and pieces together from too many Google searches. Here it is, comments and all: private BufferedImage toCompatibleImage(BufferedImage image) { // obtain the current system graphical settings GraphicsConfiguration gfxConfig = GraphicsEnvironment. getLocalGraphicsEnvironment().getDefaultScreenDevice(). getDefaultConfiguration(); /* * if image is already compatible and optimized for current system … Read more

Java2D: Increase the line width

You should use setStroke to set a stroke of the Graphics2D object. The example at http://www.java2s.com gives you some code examples. The following code produces the image below: import java.awt.*; import java.awt.geom.Line2D; import javax.swing.*; public class FrameTest { public static void main(String[] args) { JFrame jf = new JFrame(“Demo”); Container cp = jf.getContentPane(); cp.add(new JComponent() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)