Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        JTextArea textarea = new JTextArea();
        textarea.setDragEnabled(true);

        textarea.setText("Drag target");

        frame.getContentPane().add(BorderLayout.CENTER, textarea);

        JTextField textarea1 = new JTextField();
        textarea1.setText("Drop target");
        frame.getContentPane().add(BorderLayout.SOUTH, textarea1);

        frame.setSize(500, 300);
        frame.setVisible(true);
        frame.setLocation(100, 100);
    }
}