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 在按钮上加上不可用图标.

最新文章

  1. Docker学习---ubuntu环境
  2. Codeforces 549D. Hear Features[贪心 英语]
  3. 给自定义cell赋值
  4. C#中通过Selenium定位<a>标签的问题
  5. 经验总结17--submitbutton,ajax提交
  6. GIT入门篇-基本概念与操作
  7. HTML5数组方法
  8. ok6410驱动usb摄像头
  9. CSS3里面的高级属性
  10. fzu 1911 C. Construct a Matrix
  11. React组件开发(二)表达式
  12. 201521123024 《Java程序设计》第5周学习总结
  13. Dynamics AX 2012 R2 电子邮件广播错误 0x80040213
  14. BZOJ 3684 大朋友和多叉树
  15. Jmeter性能测试之参数化(二)
  16. zend cache使用
  17. C# 调用微信接口上传素材和发送图文消息
  18. 学习windows编程 day4 之 映射模式
  19. printf 输出% 和 \
  20. MathExam

热门文章

  1. (原创)发布一个c++11开发的轻量级的并行Task库TaskCpp
  2. [DIOCP3/MyBean/QDAC开源项目] DataModule-DB例子基于MyBean的插件实例<三层数据库方案>
  3. 设计模式之开放-封闭原则(引申出Objective-C中继承、Category、Protocol三者的区别,这点面试常问)
  4. Android开发(八)——Android组件
  5. win8中的参数传递
  6. 未能加载文件或程序集“System.Web.Mvc, Version=3.0.0.0,
  7. 在IIS中访问APS页面时提示:“最可能的原因使用的托管的处理程序,但是未安装或未完整安装asp.net“
  8. php多路复用(多线程)socket相关应用
  9. MySQL日志——二进制日志
  10. 【Unity】使用JSONObject解析Json