JTable单元格中的JPanel [英] JPanel in a cell of a JTable

查看:85
本文介绍了JTable单元格中的JPanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将JPanel放入JTable的单元格中?
(会有一列将包含String对象,而另一列将包含JPanel对象.)

How could I put a JPanel into a cell of a JTable?
(There would be a column what would contain String objects, and an other column with JPanel objects. )

推荐答案

阅读有关使用自定义渲染器的部分. ColorRenderer示例将JLabel放入单元格中.您可以轻松地将其更改为使用JLabel.

Read the part that talks about using Custom Renderers. The ColorRenderer example puts a JLabel in a cell. You could easily change that to use a JLabel instead.

这篇关于JTable单元格中的JPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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