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.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import javax.swing.text.DefaultCaret;

public class Main {
    public static void main(String args[]) {
        JTextArea textArea = new JTextArea();

        JFrame f = new JFrame();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        DefaultCaret caret = new DefaultCaret() {
            @Override
            public boolean isSelectionVisible() {
                return true;
            }
        };
        textArea.setCaret(caret);
        textArea.setFont(new java.awt.Font("Miriam Fixed", 0, 13));

        Color color = Color.BLUE;
        // textArea.setBackground(color);
        textArea.setSelectedTextColor(color);
        f.getContentPane().add(new JScrollPane(textArea));
        f.pack();
        f.setVisible(true);
    }
}