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

What is a framework, A framework is made up of the set of classes which per...

A framework is made up of the set of classes which permit us to use a library in a best possible way for a particular requirement.

What is meant by semantic error, What is meant by semantic error? Occur...

What is meant by semantic error? Occur while a statement executes and has an effect not intended through the programmer and Frequently times occur only in unusual & infrequent

Create a link list iterator, In this assignment, you will gain experience i...

In this assignment, you will gain experience implementing the java.util.List interface. This includes writing an inner class called Node and another inner class called CS228LinkedL

I want solution to this question., This assignment is based on the principl...

This assignment is based on the principles of clock consistency and associated drifts in a distributed system. You have to create a simulation, running on a single machine, of a si

data integrity - security component, Data integrity helps to make sure if ...

Data integrity helps to make sure if something is communicate and not tampered with in the mean while when transmission take place. Checksums: Simply inserts the bytes withi

Student, Your class must contain the followings (20 points):Code a simple c...

Your class must contain the followings (20 points):Code a simple class in JAVA classed “Student. · Variables (name, age, addressStreet, city, state, zip, country) ·

List the keywords which are used in java 1.1, List the keywords which are u...

List the keywords which are used in java 1.1? The list of keywords which are used in java 1.1 are given below: Keyword Purpose boole

Java program to do the following operations:, Read information of n student...

Read information of n students. The class name should be kkhsou with the member variable name, rollno, center_code and percentage in last examestion.Display the students data whose

Give an example for using getter methods, Give an example for Using Getter ...

Give an example for Using Getter Methods ? class CarTest6 { public static void main(String args[]) { Car c = new Car(); c.setLicensePlate("New York A45 636"); c.setMa

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