This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I'm pretty new to applets, but I'm trying to turn my Fractal explorer program into an applet. In the original application, I was calling the paintComponent(Graphics g) method, and within this, I was displaying a image, as well as other things, and whenever I had to repaint() the frame many times, it was fine.
But now, I'm using an applet and a paint(Graphics g) method. Again I'm initially displaying an image, and a moving box, but whenever repaint() is called, the screen flashes, the basic code is shown below:
I didn't want to use a JFrame, becuz I wanted the output to go into a rectangle on the HTML screen. There is an alternative I can think of, using an OverlayLayout, but I would rather see if there is anyway around this first. Thanks for any help.
Oh sorry, I should have explained better. Using JApplet instead of Applet, and paintComponent(Graphics g) instead of paint(Graphics g) now just shows a blank grey screen, except for the panel of 4 buttons at the bottom.
I've created a new small JApplet (see my other post about JApplet), I can't even get this to draw a line. I'm probably missing something stupid, but I don't know what. Any advice is much appreciated, thanks.
Joined: Mar 22, 2005
I've never used JApplets, but there's an introduction over at java.sun.com.
Joined: Apr 11, 2005
Thanks, I was looking at it earlier. I looked at an example, they had an inner class of the class that extends JApplet, which extended JPanel. I copied this idea for my applet, but it wouldn't upload when I tried to use Geocities for my website, because of the $ in the inner class name.
But then I figured out how to write the classes separatly and it worked. Its taken me the whole day to get this far, but I've finally done it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Why is screen flashing when I call repaint()?