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

Brute force search, how to implement brute foce in a program?

how to implement brute foce in a program?

Payroll calculator, how to write aprogramm that calculates gross pay, taxe...

how to write aprogramm that calculates gross pay, taxes, and net pay for both hourly and commission employees. It will then display those results to the screen

How many bits are used to show unicode and ascii, How many bits are used to...

How many bits are used to show Unicode, ASCII, UTF-16, and UTF-8 characters? Unicode requires 16 bits and ASCII require 7 bits although the ASCII character set uses only 7 bits

Three ways in which a thread can enter the waiting state, What are three wa...

What are three ways in which a thread can enter the waiting state ?

Padovan series, write a program in java using array and scanner class to ge...

write a program in java using array and scanner class to generate padovan series

Develope a simple polling web application, Develop a simple polling (voting...

Develop a simple polling (voting) web application according to the following specifications: Initially a page should be presented to the user where he can enter his/her name

The software or script to scan automotive ads, The software or script to sc...

The software or script to scan automotive ads Project Description: Looking for a company that made the script or application to search through pages of listings of automotive

Write program for queue of cards, A Queue of Cards You are going to par...

A Queue of Cards You are going to parallel the development done in the lesson on inheritance where we constructed some base classes, StackNode and Stack, and derived  Floa

Prepare a game in corona, Prepare a Game in Corona (for Android and IOS) ...

Prepare a Game in Corona (for Android and IOS) Project Description: We are looking to prepare a game for mobile platform similar to Zombie Smasher for iOS and Android. Eve

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