Domanda

I've prepared transparent Button class:

public MyButton() {

        super("button");
        setOpaque(false);
        setContentAreaFilled(false);
        setBorder(null);
        setBorderPainted(false);
    }

But button is not fully transparent. When it is clicked it looks like this:

enter image description here

Is there any way to avoid this annoying rectangle? There is no such problem in default L&F but I'd like to use SystemLookAndFeel.

È stato utile?

Soluzione

You could do

setFocusPainted(false);

Note: All the above functionality can be achieved by just creating an instance of JButton and using rather than sub-classing the component

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top