I developed an application to create the following result: 
I overridden JPanel getPrefferredSize, but why am I not seeing any changes in output when resizing. Even if I set the size to 0.0, the chart is not translated at all, and I get the same result as shown above.
Here is my complete code: -
import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.geom.Ellipse2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Skeleton extends JFrame{ Skeleton() { super("Donut"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400,400); add(new Board()); setVisible(true); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable(){public void run(){new Skeleton();}}); } } class Board extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2=(Graphics2D)g; RenderingHints rh=new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
source share