欢迎来到天天文库
浏览记录
ID:16999999
大小:2.01 MB
页数:8页
时间:2018-08-26
《java专题1之如何制作透明背影的文字按钮》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、JAVA专题1:如何自制不带边框的文字按钮?首先,准备一张背景透明的文字图片,这张图片可以用photoshop来制作;现在来说一下如何制作这张图片的大概步骤:1,新建一个文件,在上面输入你想要的文字如:2,将背景设为透明,YibinCityCitytracktrafficplanningisYibincityregionalrangewithintracktrafficsystemofonceintegration,andcitytracktrafficalsoisYibinCityCityintegratedtracktrafficsystem
2、intheofpart,foraccurategraspcitytracktrafficresearchofobject3,将文件存储为wed模式的gif格式,YibinCityCitytracktrafficplanningisYibincityregionalrangewithintracktrafficsystemofonceintegration,andcitytracktrafficalsoisYibinCityCityintegratedtracktrafficsystemintheofpart,foraccurategraspcit
3、ytracktrafficresearchofobject打开效果如下:但因图片过大,若用于编程不太方便使用,所以对图片进行编辑让其变小:YibinCityCitytracktrafficplanningisYibincityregionalrangewithintracktrafficsystemofonceintegration,andcitytracktrafficalsoisYibinCityCityintegratedtracktrafficsystemintheofpart,foraccurategraspcitytracktraff
4、icresearchofobject经过这样的处理再进行保存,图片已不再是透明的了,所以需再用PS稍微进行编辑:从PS中打开“Hello.gif”文件:YibinCityCitytracktrafficplanningisYibincityregionalrangewithintracktrafficsystemofonceintegration,andcitytracktrafficalsoisYibinCityCityintegratedtracktrafficsystemintheofpart,foraccurategraspcitytra
5、cktrafficresearchofobject使用魔法棒进行处理:使用魔法棒单击图片,再按Del,是背景透明:再保存为普通的Gif格式即可(注意,此时已不再需要保存为web的gif了)这样,图片材料就处理完毕了,接下来就是编程方面的问题了:图片材料:“beijing3.gif”、“Hello.gif”YibinCityCitytracktrafficplanningisYibincityregionalrangewithintracktrafficsystemofonceintegration,andcitytracktrafficalsoi
6、sYibinCityCityintegratedtracktrafficsystemintheofpart,foraccurategraspcitytracktrafficresearchofobject实例代码如下:packagedemo;importjava.awt.BorderLayout;importjava.awt.Graphics;importjavax.swing.ImageIcon;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JTextF
7、ield;importjavax.swing.JPanel;classImagePanelextendsJPanel{protectedvoidpaintComponent(Graphicsg){super.paintComponent(g);ImageIconicon=newImageIcon("beijing3.jpg");g.drawImage(icon.getImage(),0,0,null);YibinCityCitytracktrafficplanningisYibincityregionalrangewithintracktraff
8、icsystemofonceintegration,andcitytracktrafficalsoisYibinCityCityinte
此文档下载收益归作者所有