Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image as background fot buttons

Status
Not open for further replies.

Raywall

Programmer
Oct 1, 2003
51
RO
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:
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);
 
Because for the moment I don't know swing and I had to find out the thing with the image when I posted this.
By the way, why don't you have an english version for your page( if you don't mind asking)?
 
>>>> By the way, why don't you have an english version for your page( if you don't mind asking)?

Because Stefan is German maybe ?!!!
Do you have a website in German ?!!!

[rofl]

--------------------------------------------------
Free Database Connection Pooling Software
 
Good point :) I've noticed that Stefan is german, but let's think a little bet about the concept of www. It means world wide web.
We don't use cwb (country wide web) so what's so wrong in using a language like english so that everyone would understand?
If I would have posted my question in romanian then Stefan would have replied with something nice like "What the hell did you typed here??? I don't understand a thing!!!"
When you make a personal page you guess that someone would be interested in visiting it.How can I do this if I don't understand german?
Whatever, I said >>>>"if you don't mind asking"
I'm sorry for your reaction, but I was a little bet frustrated when I've entered his page and that's why I've asked him....
If you feel uncofortable with my posts then I won't post anymore and thats it.
Thank you for your time anyway sedj.
 
Chill fella - its all friendly round here !

We all know that English is in effect the defacto langauge of the web, as with international law, airline control systems, international shipping and many other things - but it doesn't mean we should expect it, thats all I was saying ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Yeah I guess I had too much cofee for today and that's why your post seemed to me a little agressive. but maybe I was wrong.
Sorry for the previous post.
 
Well - we started more or less off topic - Java (Sun) would have been a better forum - let's continue off topic.

A world-wide-web needn't be a one-language-net.
For historic reasons, - it grew fastest in the US, and had most of it's roots there, and only few in europe - english is the first language in the net.
But wait few years, and you get asked, why you don't have a chinese webpage.
Or indian.

My actual link points to a german page, because I would prefer a job in germany, and aren't going for a job in Sweden, GB, Italy or Argentina.
Well - Brasil perhaps :)

If you would have went a step up you would have seen, that most pages are either english, or alternative en/de/(fr).

I hope I can soon remove the link to 'seeking job'.
---
To your question:
Code:
ImageIcon ii = new ImageIcon ("./18.jpg");
JButton testButton = new JButton (ii);
is the swing-way - don't know whether it works in AWT the same.


seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top