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

What does wan stand for, What does WAN stand for? Wide Area Network - A...

What does WAN stand for? Wide Area Network - A network in that computers are separated through great distances classically across cities or even continents.

Extensible messaging and presence protocol, According to XMPP Standards Fou...

According to XMPP Standards Foundation "XMPP is the Extensible Messaging and Presence Protocol, a set of open technologies for instant messaging, presence, multi-party chat, voice

Java server faces - eagro portal project, eAgro Portal Project: Techno...

eAgro Portal Project: Technology Used: Java Server Faces, JSR 168 Specification, Websphere Portal Server5.0, DB2 database And Rational Application Developer, Jasper Report Too

I want customize tumblr theme, I need Customize Tumblr theme Project Des...

I need Customize Tumblr theme Project Description: I have a blog here I would like to customize it as follows; 1) Modify the horizontal navigation from the bottom of th

A talent agency program , class Writer extends Client {    // additional m...

class Writer extends Client {    // additional members    private boolean technical = false;    private boolean government = false;    private boolean international = false;    pri

Develop tennis draw software, Project Description: We need to develop so...

Project Description: We need to develop software that has a database of players with the ability to delete and add players at will, once captured there can be a draw to set them

Develop a 3d rolling alarm clock, Need to develop a 3D rolling alarm clock ...

Need to develop a 3D rolling alarm clock (Android) Project Description: I want an android app as 3D rolling alarm clock It should have sound effect when setting the alarm

While statement in java, The while statement define a loop that iterates as...

The while statement define a loop that iterates as long as condition remains true. In the following instance the control waits till the value of a text field becomes "go":

Java and Arrays, AskWrite an application that uses an Array to store 10mess...

AskWrite an application that uses an Array to store 10messages of type String. You will store this Array with 10 messages of your choosing. For example, a message could be “I love

What are the different modules in spring framework, Different modules in sp...

Different modules in spring framework are:- a)  The Core container module b)  AOP module (Aspect Oriented Programming) c)  Application context module d) JDBC abstractio

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