Explain code and document bases, JAVA Programming

Assignment Help:

Explain Code and Document Bases ?

If you don't know the exact URL of the image, but you do know its name and in which it's in the similar directory as the applet, you can use an alternate form of getImage() that takes a URL and a filename. Use the applet's getCodeBase() method to return the URL to the applet directory like this:

Image img = this.getImage(this.getCodeBase(), "test.gif");

The getCodeBase() method returns a URL object in which points to the directory where the applet came from.

At last if the image file is stored in the similar directory as the HTML file, use the similar getImage() method but pass it getDocumentBase() instead. This returns a URL those points at the directory that contains the HTML page in which the applet is embedded.
Image img = this.getImage(this.getDocumentBase(), "test.gif");

If an image is loaded from the Internet, it might take some time for it to be fully downloaded. Most of the time you don't need to worry about this. You can draw the Image as soon as you've linked it to a URL using one of the above methods. Java will update it as more data becomes available without any further intervention on your elements.

Load all the images your applet requires in the init() method. In particular you do not want to load them in the paint() method. If you do they will be reloaded each time your applet repaints itself, and applet performance will be abysmal.


Related Discussions:- Explain code and document bases

Listening for roster and presence changes, The typical use of the roster cl...

The typical use of the roster class is to display a tree view of groups and entries along with the current presence value of each entry. As an example, see the image showing a Rost

Explain identifiers in java, Explain Identifiers in Java ? Identifiers ...

Explain Identifiers in Java ? Identifiers are the names of variables, classes, methods, packages and interfaces. Unlike literals they are not the things themselves, only ways o

Develop news feed android app design template, Project Description: You ...

Project Description: You should give A Working, Sample Android .apk Project and Java source code Original Photoshop PSD that I can edit and customize to fit my needs All S

Make a function in java script and compare with ten, Write JavaScript code ...

Write JavaScript code for the following: Make a function compare With Ten (value) Compare the function argument along with ‘10' and display a message while the value is le

Kik messenger program, Kik Messenger is a plan mobile messenger like Skype....

Kik Messenger is a plan mobile messenger like Skype. It's available on each major smart phone for Android and Iphone. Here is the entire process: Could be able to add multipl

Thread, create thread without extending anything

create thread without extending anything

What is mvc, Model-View-Controller (MVC) is a design pattern put together t...

Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. ? Model: The model having the core of

Illustrate the method to print on the GUI, Illustrate the method to print o...

Illustrate the method to print on the GUI Example Code: Taking Input / Output So far, we learned how to print something on console. Now time has come to learn how to print

Explain bean lifecycle in spring framework, 1. The spring container searche...

1. The spring container searches the bean's definition from the XML file and instantiates the bean. 2. Using the dependency injection, spring populates all of the properties as

Currency calculator, I have to write a several line currency exchange rate ...

I have to write a several line currency exchange rate calculator.it wants me to use a variable and prompt var dollarAmount = Prompt("Enter amount in U.S. dollars:"); and give t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd