java - jlabel中的strectching图像 [英] java - strectching image in a jlabel

查看:223
本文介绍了java - jlabel中的strectching图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我使用的代码



this is my code im using

//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);





我想知道如何修改代码以便我得到的图像web sill strectch并适合标签的大小?因为我一直在网上寻找这个,我发现这些似乎不起作用的抛光代码和我试过的其他真实代码,有人可以帮助我吗?



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?

推荐答案

从来没有 - 永远 - 我永远不会说!!!



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

FrontImage = new JLabel(image2);





变量总是以小写字母开头。大写保留用于对象命名。





问题:如果图像不够大,则不会填充标签。



寻找胖子图标,它是一个专业的,大型(+3500)图标免费使用。

您可以直接在代码中包含所需的代码(/在旁边的资源文件夹中)。



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).


这篇关于java - jlabel中的strectching图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆