JList中的项目可以格式化为HTML [英] Can Items in a JList be formatted as HTML

查看:131
本文介绍了JList中的项目可以格式化为HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Java中创建一个JList,以便每个单独的项目都使用HTML标签进行格式化,但我不清楚如何做到这一点,或者即使这是可能的。有没有人有任何建议?

I would like to create a JList in Java so that each individual item is formattted using HTML tags, but I'm not clear how to do this or even if this is possible. Does anyone have any suggestions?

谢谢。

推荐答案

其实很简单。对于列表中的每一个字符串,都用下面的html标签包围它:

Its actually very simple. For every string in the list surround it with the html tags such as this:

<html><font color=green>this will be green</font></html>

当JList显示它时,它会变绿。

When the JList displays it it will be green.

这篇关于JList中的项目可以格式化为HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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