Below java code example shows how to set JLabel class foreground color.Execute it in your browser to see the results. /** * * @author E...
Below java code example shows how to set JLabel class foreground color.Execute it in your browser to see the results.
/** * * @author Eric * Blog:www.techoverload.net * */ import java.awt.Color; import javax.swing.JLabel; import javax.swing.JFrame; public class JLabelExample extends JFrame{ JLabelExample() { super("JLabel Example"); JLabel label=new JLabel("JLabel Example"); label.setForeground(Color.WHITE); label.setBounds(0,0,600, 200); add(label); setSize(300,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(null); setVisible(true); } public static void main(String args[]) { new JLabelExample(); } }