Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ git.properties

#IDEA Project Files
.idea/
/bin/
41 changes: 41 additions & 0 deletions src/editor/TextEditor.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,52 @@
package editor;

import java.awt.Container;

import javax.swing.*;

//A simple JTextArea component

public class TextEditor extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;

//constructor - initializing a JTextArea component
public TextEditor() {
JTextArea area = new JTextArea(); //constructor of the JTextArea component.
JScrollPane spane = new JScrollPane(area); //make the text scrollable

area.setLineWrap(true); //makes the lines wrapped if they are too long to fit the text area's width.
area.setWrapStyleWord(true); //lines will be wrapped at word boundaries—white spaces.

createLayout(spane);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 300);
setVisible(true);
setTitle("JTextEditor");
}

private void createLayout(JComponent... arg) {

Container pane = getContentPane();
GroupLayout gl = new GroupLayout(pane);
pane.setLayout(gl);

gl.setAutoCreateContainerGaps(true);
gl.setAutoCreateGaps(true);

gl.setHorizontalGroup(gl.createParallelGroup()
.addComponent(arg[0])

);

gl.setVerticalGroup(gl.createSequentialGroup()
.addComponent(arg[0])
);

pack();
}

}