Reputation: 858
Is there a way to set out what you want a button style to be then use this pre made style settings on all/certain buttons. For instance have a couple pre set button styles that you are able to set groups of buttons to have instead of having to change all the style settings for each button individually. Thanks for any help :)
Upvotes: 1
Views: 1120
Reputation: 779
You can always create a custom button by extending JButton and use that one instead
public class CustomButton extends JButton {
public CustomButtong(String text) {
super(text);
setOpaque(true);
setBackground(Color.RED);
}
}
Now you can import the class and use it just like a JButton, for example
CustomButton button = new CustomButton("Click me!");
You can modify the constructor to your needs.
Upvotes: 1