Solved

refreshing a canvas in an applet.

Posted on 2002-06-19
2
409 Views
Last Modified: 2006-11-17
Hi,
 I am working on a project which opens a Frame from within an applet.WHenever I draw an image  and another  window covers the image in the canvas, the image disappears and I have to click drawPlat(bal/unbal) again to get it back. I am trying very hard but could not find a Solution. I will really appreciate any helps.

The URL is:
http://www.cse.sc.edu/~group8/beta6/

The java file is:
http://www.cse.sc.edu/~group8/beta6/SurveyApp.java

Please help me and I will greatlt appreciate .

Note: I am supposed to use just basic Java.

Thanks
0
Comment
Question by:Alfred_here
  • 2
2 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7094350
Sounds like your not painting the image in the components paint() method. The paint() method is called whenever part of a component is required to be redrawn so all painting should be performed in the is method.

0
 
LVL 92

Accepted Solution

by:
objects earned 150 total points
ID: 7094359
Painting of your FCanvas object is done from a seperate component. You should instead be handing the painting inside the FCanvas class:

class FCanvas extends Canvas{
     FCanvas(){
          super();
     }
     public void paint(Graphics g){
         // paint calls should in here
     }
}
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now