
Assigning shortcut "ESC" for "Exit" Menu ItemĮxit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)) tAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK)) Assigning shortcut "Ctrl + P" for "Print" Menu Item Creating MenuItem "Print" in text editor tAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)) Assigning shortcut "Ctrl + S" for "Save" Menu Item tAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)) Assigning shortcut "Ctrl + O" for "Open" Menu Item tAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)) Assigning shortcut "Ctrl + N" for "New" Menu Item J) setWrapStyleWord(true): This function sets the word-wrapping policy of the text area. I) setLineWrap(true): This function sets the line-wrapping policy of the text area. H) setFont(Font): This function sets the font family, font style, font size of the textarea and textfield. G) setSelectionMode(MODE): This function sets the selection mode of the list, it can be single or multiple.

It is used to define the size of frame/window, panel, etc.Į) add(obj): This function is used to add the components in a sequential manner to the frame or panel.į) setAccelerator(KeyStroke keyStroke): This function sets the short-cuts keyboard for the respective menu item. By default, it is false.ĭ) setSize(int width, int height): This function takes two parameters such as height and width. We will create a menu such as File, Edit, Format & Sub-Menu in that such as New File, Open File, Save File, Exit, Select All Text, Cut, Copy, Paste, Change Font Family, Change Font Style, Change Font Size, etc.Ī) setLayout(layout): This function will define the layout of the frame, window, pane, in which all the components are arranged.ī) setText(“your text”): This function will set the title or the text on the label, button,etc.Ĭ) setVisible(true): This function will make the frame or window visible to the user. In this very initial step, we will create the basic user interface for our Notepad Desktop Java Application.

In this step, we will import File, AWT & Swing required packages import java.io.* These are the step to build Notepad Text Editor using Java:

Please download the source code of Java Notepad: Notepad Java Project Code Steps to Create Notepad – Text Editor Java Project Java provides by default packages such as Abstract Window Toolkit (AWT) & Swing packages to create user interface(UI) for desktop applications.

