You are here:   HomeJava ProgrammingSwinggetImage in Java Swing Example
by Dinesh Thakur Category: Swing


import java.awt.*;

import java.applet.*;
import javax.swing.*;
public class JEventImageJavaExample extends JApplet
                   Image img;
                    final int WIDTH = 338;
                    final int HEIGHT = 124;
                    public void init()
                               img = getImage(getCodeBase(),"Koala.jpg");
                               public void paint(Graphics gr)
                                        gr.drawImage(img, 0, 0, this);
                                        gr.drawImage(img, 0,0, WIDTH * 2, HEIGHT * 2, this);

getImage in Java Swing Example

Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.

What's New and Popular

Popular Article