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)
                                  {
                                        super.paint(gr);
                                       
                                        gr.drawImage(img, 0, 0, this);
                                       
                                        gr.drawImage(img, 0,0, WIDTH * 2, HEIGHT * 2, this);
                                  }
     }

getImage in Java Swing Example



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular 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.



Related Articles