How to change button color in java swing?
Answer / Amit Garg
To change the button color in Java Swing, you can set its background using BasicStroke. Here's an example:
```java
import javax.swing.*;
import java.awt.*;
public class ColorButton extends JButton {
public ColorButton(String text, Color color) {
super(text);
setBackground(color);
}
}
```
You can then use this custom button in your code.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the default look and feel of a Swing Component?
What is the function of internal frame in swing?
Is javafx better than swing?
Which containers use a border Layout as their default layout in swing?
Is swing still used?
Which method of the Component class is used to set the position and size of a component?
Explain the difference between jfc & wfc.
What are the advantage of swing over awt?
What is the function of abstractaction class?
what do u mean by GUI framework
When we should go for codebase in applet?
What is swing and awt in java?