Seeker
Seeker

Reputation: 509

How to set the text colour on a button? JAVA

how do you set the text colour on a button. I have tried this but it is not working.

  JButton button1 = new JButton();
    button1.setForeground(Color.RED);
    button1.setText("Close");
    button1.setEnabled(false);

The colour stays black.

Upvotes: 0

Views: 624

Answers (1)

camickr
camickr

Reputation: 324118

is it possible to change the color when the button is disabled

You may be able to use the UIManager for this. See UIManager Defaults for more information.

If you can use the UIManager, then you will need to create a custom UI.

Upvotes: 1

Related Questions