A little java system to show photograph on JPanel. Client can choose any picture record from the hard drive and appear on the casing. Picture record can be jpg, gif, bmp or some other upheld illustrations document.
/*******************************************************
* MYCPLUS Sample Code - http://www.mycplus.com *
*
* This code is made accessible as a support of our *
* guests and is given entirely to the *
* reason for representation. *
*
* Please guide all request to saqib at mycplus.com *
*******************************************************/
import java.awt.event.ActionListener;
import java.awt.event.*;
import java.awt.Graphics2D;
import java.awt.Graphics;
import java.awt.*;
import java.io.File;
import java.net.*;
/import java.media.*;
import javax.swing.*;
import java.awt.geom.*;
open class Photo develops JFrame
{
open static JFrame outline;
open static Image img;
open static JFileChooser f;
open static JPanel board;
open static JButton catch;
open static Graphics2D g2d;
open static Graphics g;
open static myPanel p;
open static void main(String st[]){
frame=new JFrame("FIAZ GUL KHAN JADOON");
Toolbox kk=frame.getToolkit();
Measurement dd=kk.getScreenSize();
dd.width=800;
dd.height=570;
frame.setBounds(0,0,dd.width,dd.height);
frame.getContentPane().setBackground(Color.black);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f=new JFileChooser();
f.showOpenDialog(frame);
Record fc=f.getSelectedFile();
String str=fc.getPath();
ImageIcon icon=new ImageIcon(str);
img=icon.getImage();
myPanel p=new myPanel();
frame.getContentPane().add(p);
frame.setVisible(true);
}
static class myPanel develops JPanel{
open void paint(Graphics g){
g.drawImage(img,0,0,this);
}
}
}