How to paint on a Netbean 6.5 generated applet?
Hello everyone:
I wish to create an applet using Netbeans 6.5 and paint on it with instructions as, for example,
gr.setColor(Color.YELLOW);
gr.fillRect(10, 10, 100, 100);
etc.
I created an applet according to Netbeans help instructions, that is:
File/New project/Java/Java class library…
Later:
I right clicked over the project icon /New/Other/Swing GUI forms/JApplet form.
I have added controls etc.. but I’m not able to paint anything on the applet.
I tried many ways…,
I have created my own panel class extended from JPanel and overrode the paint() method…,
I have obtained the graphics context by getGraphics()…,
I have added Internal frame to my main class (extended from JApplet) etc.
but always unsuccessfully.
Source code compiles fine, no errors reported, but I only see the controls added, never what I tried to paint.
Could you please let me know what should I do to paint something on the applet?
Sorry, I have been studying Java only since two weeks ago.
Thanks a lot in advance
Pucho
Note: I can paint on a simple applet (not using Swing) but losing all of the Swing advantages.