I was trying some solutions, and every of them failed. Until now, I had thought that anything is possible in Java. One of my solution, that don't makes compilation warrning and runs (but checkbox is missing anyway) is:
jbuttonjcheckbox.jpg
class myCheckBox extends JCheckBox implements Icon { int w = 20; public myCheckBox() { super(); setSelected(true); setFocusPainted(false); setOpaque(false); setToolTipText(" close route "); addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { } } }); } public void paintIcon(Component c, Graphics g, int x, int y) { } public int getIconWidth() { return w; } public int getIconHeight() { return w; } }
then
myCheckBox CB = new myCheckBox(); button.setIcon(CB);
Any tryings of creating own button class with own content manager fails as well. Any ideas to solve this?