So, let's first see this is done on NetBeans IDE using the JFrame Form file. Firstly, drag a JLabel from the palette on to the JFrame. Then select the JLabel and go to the Properties window on the bottom right corner. There you will see Background property then choose the desired color.
Simply the code is
jLabel1.setForeground(Color.red);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With