hi everyone
how can i load a picture which i want to use in my program?
actually i have wore this code below but i guess the problem is i
dont know how to add the BufferedImage to the Frame, i will be
grateful if u help me
regards
razieh
import java.awt.image. BufferedImage;
import java.io.File;
import java.io.IOExcep tion;
import javax.imageio.I mageIO;
import javax.swing.JFr ame;
public class Target extends JFrame
{
BufferedImage img;
public Target()
{
try
{
img = ImageIO.read(ne w File ("C:\\Target.jp g"));
setDefaultClose Operation (EXIT_ON_CLOSE) ;
setVisible (true);
setSize(500,500 );
}
catch(IOExcepti on e)
{
System.out.prin tln("file does not exist");
}
}
public static void main(String []args)
{
new Target();
}
}//end of class
how can i load a picture which i want to use in my program?
actually i have wore this code below but i guess the problem is i
dont know how to add the BufferedImage to the Frame, i will be
grateful if u help me
regards
razieh
import java.awt.image. BufferedImage;
import java.io.File;
import java.io.IOExcep tion;
import javax.imageio.I mageIO;
import javax.swing.JFr ame;
public class Target extends JFrame
{
BufferedImage img;
public Target()
{
try
{
img = ImageIO.read(ne w File ("C:\\Target.jp g"));
setDefaultClose Operation (EXIT_ON_CLOSE) ;
setVisible (true);
setSize(500,500 );
}
catch(IOExcepti on e)
{
System.out.prin tln("file does not exist");
}
}
public static void main(String []args)
{
new Target();
}
}//end of class
Comment