Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code im using

Java
//front
		URL url2 = new URL("http://mcskinsearch.com/img/cache/pic/z3nox.png");
		image2 = new ImageIcon(ImageIO.read(url2));
		FrontImage = new JLabel(image2);
		Border border = BorderFactory.createLineBorder(Color.BLACK, 1);
		FrontImage.setBorder(border);
		FrontImage.setBounds(10, 11, 274, 236);
		contentPane.add(FrontImage);


I was wondering how do I modify the code so the image I am getting from the web sill strectch and fit the size of the label? because I have been looking on the web for this, and I find these buffing codes which don't seem to work and other verious code which I have tried, can some one please help me?
Posted

1 solution

NEVER - NEVER EVER - DID I SAY NEVER!!!

Java
FrontImage = new JLabel(image2);


Variables are ALWAYS starting lower case. Upper case is reserved for object naming.


The problem: If the image isn't big enough, it will not be filling the Label.

Look for "fatcow icons", it's a professional looking, big set (+3500)of icons free to use.
You can include the needed ones directly with your code ( / in resource-folder beside).
 
Share this answer
 
Comments
[no name] 18-Jul-13 19:55pm    
I'm just trying to put a image on the screen that stretches. the same as you can do with a picture box in c#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900