e740. 向标签中加入一个图标
2024-08-31 08:53:12
This example creates a JLabel
component with an icon.
// Fetch icon
Icon icon = new ImageIcon("icon.gif"); // Create a label with text and an icon; the icon appears to the left of the text
JLabel label = new JLabel("Text Label", icon, JLabel.CENTER); // Create a label with only an icon
label = new JLabel(icon);
This example adds or replaces the icon in an existing JLabel
component:
// Add an icon to an existing label
label.setIcon(icon);
The methods to control the position of the icon and text within a JLabel
component are identical to those of a JButton
. See also e747 在按钮上移动图标的位置, e748 在按钮上移动图标和标注的位置, e749 设置按钮上图标和标注的间隔, and e750 在按钮上加上不可用图标.
最新文章
- Docker学习---ubuntu环境
- Codeforces 549D. Hear Features[贪心 英语]
- 给自定义cell赋值
- C#中通过Selenium定位<;a>;标签的问题
- 经验总结17--submitbutton,ajax提交
- GIT入门篇-基本概念与操作
- HTML5数组方法
- ok6410驱动usb摄像头
- CSS3里面的高级属性
- fzu 1911 C. Construct a Matrix
- React组件开发(二)表达式
- 201521123024 《Java程序设计》第5周学习总结
- Dynamics AX 2012 R2 电子邮件广播错误 0x80040213
- BZOJ 3684 大朋友和多叉树
- Jmeter性能测试之参数化(二)
- zend cache使用
- C# 调用微信接口上传素材和发送图文消息
- 学习windows编程 day4 之 映射模式
- printf 输出% 和 \
- MathExam
热门文章
- (原创)发布一个c++11开发的轻量级的并行Task库TaskCpp
- [DIOCP3/MyBean/QDAC开源项目] DataModule-DB例子基于MyBean的插件实例<;三层数据库方案>;
- 设计模式之开放-封闭原则(引申出Objective-C中继承、Category、Protocol三者的区别,这点面试常问)
- Android开发(八)——Android组件
- win8中的参数传递
- 未能加载文件或程序集“System.Web.Mvc, Version=3.0.0.0,
- 在IIS中访问APS页面时提示:“最可能的原因使用的托管的处理程序,但是未安装或未完整安装asp.net“
- php多路复用(多线程)socket相关应用
- MySQL日志——二进制日志
- 【Unity】使用JSONObject解析Json