how do I change the opacity of a JButton

Java
MyJButton myJbtn = new MyJButton();
myJbtn.setOpacity(0.5);
myJbtn.repaint();private float opacity;
//......
public setOpacity(float opacity) {
    this.opacity = opacity;
}

public void getOpacity(){
    return this.opacity
}
Source

Also in Java: