我可以在JTable列标题中添加按钮吗? [英] Can I add a button to a JTable column header?

查看:61
本文介绍了我可以在JTable列标题中添加按钮吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JTable,其中每一行的第一列是一个复选框.用户可以选择和取消选择各个列.我已经做好了.

I have a JTable where the first column in each row is a checkbox. The user can select and deselect individual columns. I've got this working.

现在,我想在列标题中添加一个复选框,该复选框可用于全选"和取消全选".我不知道该如何去做.我不知道如何将选择的组件放在特定的列标题中.

Now I'd like to add to the column header a checkbox which can be used to "select all" and "deselect all". I'm puzzled in how I should go about doing this. I can't work out how to put a component of my choosing in a specific column header.

您有什么建议?

推荐答案

Here is an example where someone wanted to do the same thing.

这篇关于我可以在JTable列标题中添加按钮吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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