Whenever I want to add a disabled button, this seems to work as intended.
public class ButtonDemo extends JPanel {
private JButton b;
public ButtonDemo() {
b = new JButton("Button Demo");
b.setEnabled(false);
add(b);
}
}
But whenever I add the
public void paint(Graphics g)
method, the disabled button disappears.
So is there any way I could have both the paint method and the disabled buttons because I need to use the paint method to add text above the buttons.