Hello All. I'm writing an applet and I have some problems with it's design, please help ; I'm writing a chat client and I dont want to use Swings for more compatibility. I have heard that there are beans with improved graphical components. Is it true, and if it is where can I find them? But most of all I confused with creating of the images like a components. Does any one know how to do it? I tried to override paint method of the Panel class and draw image in it, but image draws not always. P.S.: Sorry for my bad English; P.S.: Please help.
Hello, With regards to the image part... This link is to a question from a few days ago. subject: hide object I'm not sure if it's the information you're searching for, but it might be related. The relevant part is the very last code section on the page. Otherwise, I've had experiences with displaying images where the image wouldn't actually show up until the Applet had been repainted 2 or 3 times. My work around was to have a code block execute upon the first call to the paint method to "preload" the images. The code block was something like:
This probably isn't the most efficient way nor the prettiest way to get the job done - but it got the job done for me. You might want to try searching through past forum threads (see the top right of this page) for the information you are after. Chances are good that these topics have been addressed a dozen times in the past six months. Hopefully this helps you. Good Luck, -Dirk Schreckmann [ February 15, 2002: Message edited by: Dirk Schreckmann ]
AWT and Swing have their own forum here on the JavaRanch. Be sure to check there - most of the stuff in the Applets forum is about client/server and code-signing.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
posted 18 years ago
Thank you for your help. I created Panel with overrided paint methed:
and images painted without problems. Sorry if i wrote in the wrong forum.
posted 18 years ago
Hello, I ran accross a nice explanation of how Java loads images. This is from Exam Prep Java 2, ed 2 from Coriolis:
The getImage methods return an Image object that is filled in as the file is read by another Thread created by the getImage call. This indirect approach is similar to the way that Web browsers load image data separately from text data. If the display of a Web page or applet had to wait for all images to be loaded, the delay could be considerable. The indirect approach also permits a program to continue despite errors in loading an image.
The java.awt.MediaTracker class lets you create an object that tracks the data-loading status of one or more Image objects.