How to drawing images at actual size, JAVA Programming

Assignment Help:

How to Drawing Images at Actual Size

Once the image is loaded draw it in the paint() method by using the drawImage() method like this

g.drawImage(img, x, y, io)

img is a member of the Image class that you should have already loaded in your init() method. x is the x coordinate of the upper left hand corner of the image. y is the y coordinate of the upper left hand corner of the image. io is a member of a class that implements the ImageObserver interface. The ImageObserver interface is how Java handles the asynchronous updating of an Image while it's loaded from a remote web site rather than directly from the hard drive. java.applet.Applet implements ImageObserver so for now only pass the keyword this to drawImage() to denotes in which the current applet is the ImageObserver that should be used.

A paint() method which does nothing more than draw an Image starting at the upper left hand corner of the applet might look like this

public void paint(Graphics g) {
g.drawImage(img, 0, 0, this);
}

This draws the image at the actual size of the picture.


Related Discussions:- How to drawing images at actual size

Describe in general how java garbage collector works, Describe, in general,...

Describe, in general, how java garbage collector works?

What does tcp/ip stand for, What does TCP/IP stand for? TCP/IP is a Pro...

What does TCP/IP stand for? TCP/IP is a Protocol type basically it is known by Transmission Control Protocol/Internet Protocol

Tictactoe, write complete application to play game tictactoe

write complete application to play game tictactoe

Concept of events and events listeners and events handlers, Question: (...

Question: (a) State and explain clearly FIVE new features of Actionscript 3.0 as compared to Actionscript 2.0. (b) Explain clearly the concept of events and events listen

How many modules are there in spring, Spring comprises of seven modules. Th...

Spring comprises of seven modules. They are.. a) The core container b) Spring context c) Spring AOP d) Spring DAO e) Spring ORM f)  Spring Web module g)  Sprin

Password Generator Software, In this exercise, I want you to generate passw...

In this exercise, I want you to generate password based on random number generator. Develop an application that keeps track of the URL, username and password. I have listed few st

Jzebra integration into open erp web client, JZEBRA Integration into (Open ...

JZEBRA Integration into (Open ERP) Web Client Local Spooling/Printing to Local Print Device on ERP Client side Project Description: JZEBRA Integration into Open ERP Web Clien

Explain the library java.lang.math, Explain the library java.lang.Math ? ...

Explain the library java.lang.Math ? The Java class library is huge. We will not cover it all presently. In fact, the remaining eight classes will focus mostly on the class lib

Want an experienced ios and android expert, Want an Experienced iOS and And...

Want an Experienced iOS and Android expert Project Description: I am seeking a super talented team or Individual for a Real Estate app. The project wants to get done in a ver

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