Quantcast
Channel: User mikyll98 - Stack Overflow
Viewing all articles
Browse latest Browse all 112

Answer by mikyll98 for How to add color background in the button admin and user? I want to change into color blue

$
0
0

To change the background color of a JButton, you can use setBackground() method, passing a java.awt.Color.

From the docs, for setBackground():

Sets the background color of this component. The background color is used only if the component is opaque, and only by subclasses of JComponent or ComponentUI implementations. Direct subclasses of JComponent must override paintComponent to honor this property.

Example:

btnAdmin.setBackground(Color.BLUE);

Viewing all articles
Browse latest Browse all 112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>