SwingExample s = new SwingExample();
super.paintComponent(g); Dimension size = getSize(); final int gap = 1; final int width = size.width-2*gap, height=size.height-2*gap; if((width > 0) && (height > 0)) { g.drawOval(gap,gap,width,height); }