0

I have the following code to make a custom looking JButton

ImageIcon icon = createImageIcon(
                    CommonUtils.class.getClassLoader().getResource("images/wright.png")
                    );
            RightSlide.setIcon( icon );
            ImageIcon icon2 = createImageIcon(
                    CommonUtils.class.getClassLoader().getResource("images/right_selected.png")
                    );
            RightSlide.setPressedIcon( icon2);
            RightSlide.setSelectedIcon(icon2);
            RightSlide.setRolloverEnabled(true); // turn on before rollovers work
            RightSlide.setRolloverIcon(icon2);
            RightSlide.setBorderPainted(false);
            RightSlide.setFocusPainted(false);
            RightSlide.addActionListener(new ActionListener(){

The code generates a custom button. The button behaves as expected when hover over, pressed, clicked, and selected. This works on MacOS and Linux (Ubuntu). But the same code has a light blue background on Windows. Where does this come from and how do I get rid of it ?

Thanks

jeremyvillalobos
  • 1,795
  • 2
  • 19
  • 39
  • its looks like LookandFeel issue.. check [How to Set the Look and Feel](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html) with example there. – Muhammad Saifuddin Nov 17 '11 at 17:39

1 Answers1

2

I think that you missing JButton#setContentAreaFilled(false); example here

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319