[英]how to remove the checkbox from jcheckbox
我用以下代码实现了listcellrender
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus)
{
String str = (value == null) ? "" : value.toString();
if ("New Tag...".equals(str))
{
JButton button = new JButton(str);
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.setFocusPainted(false);
button.setOpaque(false);
button.setMargin(new Insets(0, 24, 0, 0));
button.setHorizontalAlignment(SwingConstants.LEFT);
return button;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.