Create Notepad using Java Spring

This tutorial will guide you to learn how to Create Notepad using Java Spring.

In this tutorial we will learn hoW to Create Notepad using Java Spring with sum cool and easy examples. In many situation, you might have to come up with this type of requirement .

I know you are here just because you are in need of this awesome trick to Create or make Notepad using Java Spring. If you don’t know Create Notepad using Java Spring then you are at the right place. Becoause in this tutorial we gonna Create Notepad using Java Spring.

JFrame class is the most common Swing container, it provides a window with borders, title, minimize, maximize and close buttons on the title bar.

 

How to create notepad using Java.

 

  • Import swing.JScrollPane package.
  • Import swing.JTextAre package.
  • Import swing.JFrame package.
  • Import Swing package.

Next, we require to add functionality to new, open, save and exit menu items. Let’s being with new for it we just need to clear the text in the teaxtArea component so for that, we need to set the empty string in it.

public void createTextArea()
{
    textArea = new JTextArea();
    window.add(textArea);
}

 

finally, we discuss the major and some minor parts of the code of the project so to completely deploy or build this project we require complete code which is attached below just copy it and build or create your own  Notepad using Java Spring.

import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JFrame;

public class G
{
    JFrame window;
    JTextArea textArea;
    JScrollPane ScrollPane;

 public static void main(String[] args) 
    {
    new G();
    }
    public G()
    {
    createWindow();
    createTextArea();
    window.setVisible(true);
    }
 public void createWindow()
{
    window = new JFrame("Notepad");
    window.setSize(800,600);
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 public void createTextArea()
{
    textArea = new JTextArea();
    window.add(textArea);
}
}

So finаlly, we will get output like this which is given below.

 

Output :

 

The following is the output when we will write а line in the notepаd.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top