Posted by wireoless
on March 31, 2009 at 4:53 AM PDT
First time post here so sorry if this is the wrong place to put this, but i really could do with some help.
im trying to add a filled oval to a JPanel, without creating a 2nd class which i extend.
i have created the GUI which appears fine, but i not able to add the oval to a JPanel.
this is my code.
public class test
private JFrame newFrame = new JFrame("Test Circle");
private JPanel newPanel = new JPanel();
private JPanel newPanel2 = new JPanel();
private JTextField text = new JTextField("test field");;
private Graphics img;
* Constructor for objects of class test
newFrame.setPreferredSize(new Dimension(400, 400));
Container content = newFrame.getContentPane();
i always seem to get a NullPointerException at the line img.fillOval(60,60,60,60);
if you could point me in the right direction that would be awesome.
i really would like to know how to do this with out having to put the shape in to a seprate class and creating an object of that class