I made a text editor with very basic funtionalities. I wrote it all in one class because I really wasn't sure what to put into other classes. Right now the code is pretty messy and I want to rewrite it. I was wondering if anyone could give me some input on the different classes you would use if you were going write a text editor.

Recommended Answers

All 2 Replies

hi everyone,
Actually one class is ok for a simple text editor but if you are going to put it into different classes remember that only one class can be public if all the class are in the same file. For example if you want to do a simple textarea clipboard class do this

class clip 
{
JTextArea TextArea1 = new JTextArea("", 10,10);

public clip(JTextArea TextArea)
{
     TextArea1 = TextArea
}

public void cuttext
{
         TextArea1.cut();
}

public void copytext
{
        TextArea1.copy();
}

public void pastetext
{
     TextArea1.paste();
}

}

What i created is a simple class that handles all the text clipboard functions of the
textarea and if you still have questions post them here and i'll answer them for you

Yours Sincerely

Richard West

Thanks man. I guess I'll just keep it one class then, since it is pretty simple.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.