Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Get Image 
 

This Example shows you get the image.

 

Get Image

                         

This Example shows you get the image.

Description of the code :

Toolkit.getDefaultToolkit() : Toolkit class is used to bind the different components to specific native toolkit implementations. if we want to implementation Toolkit then firstly set System property named "java.awt.headless" is set to true.getDefaultToolkit is used for get the default toolkit.

Toolkit.getImage() : getImage method return a Image class object and this object get pixel data from the specified URL.

Graphics.drawImage() : drawImage method is used to draw a specified image as is currently available. The image is drawn with its top-left corner at (x, y) coordinate.

Graphics.drawString() : drawImage method is used for draw a specified String. Its top-left corner at (x, y) coordinate.

Frame.setSize () : setSize method is used for set the frame size.

Frame.setVisible() : setVisile method is used for visible true or false.

GetImage.java

import java.awt.*;
import java.awt.event.*;

public class GetImage extends Frame {

    Image image;
    String imageName = "javalogo.png";

    public GetImage() {

        addWindowListener(new WindowAdapter() {

            public void windowClosing(WindowEvent we) {
                System.exit(0);
            }
        });
    }

    public void paint(Graphics g) {

        Toolkit tool = Toolkit.getDefaultToolkit();
        image = tool.getImage(imageName);
        g.drawImage(image, 1030this);
        g.drawString(imageName, 17050);
    }

    public static void main(String args[]) throws Exception {

        GetImage image = new GetImage();
        image.setSize(400340);
        image.setVisible(true);
        image.setLocation(200100);
    }
}

Output




Download code

 

                         

» View all related tutorials
Related Tags: java c mac process io virtual vi number this sso ai processor to proc e il section machine ce in

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (
post your own) View All Comments Latest 10 Comments:

I like ur pro code but not very easy understable becose there is no any comments line in the programming code
which help me very easy to understand

Posted by jaynath on Sunday, 02.1.09 @ 10:57am | #84373

sir I want to know that how I can Insert an image into image box , image should be retrieved from the data base in asp.net c#

Posted by Pankaj on Saturday, 12.20.08 @ 04:41am | #82989

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.