by Dinesh Thakur Category: AWT and Applets

 

import java.awt.*;

import java.awt.event.*;
import javax.swing.*;
public class JavaExampleImageSizeIncreaser extends JApplet implements ActionListener
   {
     private ImageIcon Img = new ImageIcon("java.jpg");
     private JButton BtnZoom = new JButton("Click For Zoom View..!");
     private int Wdth,Hght;
     Container Cntnr = getContentPane();
     public void init()
     {
       Cntnr.setLayout(new FlowLayout());
       BtnZoom.addActionListener(this);
       Cntnr.add(BtnZoom);
       Wdth = Img.getIconWidth();
       Hght = Img.getIconHeight();
     }
       public void actionPerformed(ActionEvent Evnt)
        {
          Wdth = Wdth * 2;
          Hght = Hght * 2;
          repaint();
        }
          public void paint(Graphics gr)
           {
              super.paint(gr);
              gr.drawImage(Img.getImage(),0,0,Wdth,Hght,this);
           }
   }
/*<applet code= JavaExampleImageSizeIncreaser.class Height=320 width=260></applet>*/

Java Example Image Size Increaser



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