[英]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.