I want to set an image as background for a button without using swing.I've never seen an example but I tryed something and unfortunally the imageUpdate method returns true() and this means that the image is not loaded yet.
Please tell me what's wrong with the code below.
I wrote the code in a class that extends Frame:
Please tell me what's wrong with the code below.
I wrote the code in a class that extends Frame:
Code:
Button testButton = new Button();
ImageProducer imgproducer;
BufferedImage img;
try{
img = ImageIO.read(new File("D:\\18.jpg"));
}catch(IOException e){}
imgproducer=img.getSource();
testButton.prepareImage(img,100,100,this);
testButton.imageUpdate(img,ALLBITS,0,0,100,100);