Reputation: 213
Is there is a way to draw in high resolution in Swing? I tried to draw a simple shapes and the resolution of these shapes is very low.
Upvotes: 2
Views: 784
Reputation: 813
You can try turning anti-aliasing on.
public void paint(Color c, Polygon p, Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHints(new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setColor(c);
g2d.fillPolygon(p);
}
There is also more documentation here
Upvotes: 3
Reputation: 17454
You probably can't control the resolution in Swing, but you can use the rendering hints attribute from Graphics2D to tweak on the rendering quality:
Use the Graphics2D class rendering hints attribute to specify whether you want objects to be rendered as quickly as possible or whether you prefer that the rendering quality be as high as possible.
Take a look here: Controlling Rendering Quality
Upvotes: 6