Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Color;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main {
    public static void main(String[] args) {
        Color myBlack = new Color(0, 0, 0); // Color black
        //  Color myWhite = new Color(255,255,255);     // Color white
        //  Color myGreen = new Color(0,200,0);         // A shade of green

        JLabel label = new JLabel("First Name");
        label.setForeground(myBlack);

        JFrame frame = new JFrame();
        frame.add(label);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setBounds(20, 20, 500, 500);
        frame.setVisible(true);

    }
}