Editor application in java

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

📝 PHNotepad is a simple Java text/code editor (notepad) written in Java. It has also nice features such as Search tool, Find/Replace text/code, Auto-completion, Nice Image Buttons for better UX, etc.

License

pH-7/Simple-Java-Text-Editor

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

PH NotePad is a simple and light text editor (notepad) written in Java.

  • Search tool (to search text/keywords easily in the code) + highlighting the code found.
  • Find/Replace text/code.
  • Auto completion for Java and C++ keywords (files need to be saved as .java/.cpp). It can be easily expanded to support pretty much any number of languages.
  • Drag and Drop (drag files into the text area and they get loaded).
  • Nice image buttons for better UX.

Example Java Text Editor

  • Pierre-Henry Soria: hi [AT] ph7 [D0T] me
  • Achintha Gunasekara: contact [AT] achinthagunasekara [D0T] com

Download the Jar file and double click to run

Or run java -jar SimpleJavaTextEditor.jar from the command line

You can also generate easily a new jar file with the following command when you are in src/ directory jar cmvf ../manifest.mf ../SimpleJavaTextEditor.jar simplejavatexteditor/*.class

Icons directory and its files must be present on the path when running the application (so you will have to move «icons/» into «src/» directory)

Apache License, Version 2.0 or later; See the license.txt file in the notepad folder.

About

📝 PHNotepad is a simple Java text/code editor (notepad) written in Java. It has also nice features such as Search tool, Find/Replace text/code, Auto-completion, Nice Image Buttons for better UX, etc.

Источник

Text Editor in Java Project

Write a Awt application to develop a Text editor in Java . It should implement following functions as menu options or functionality of Text editor .

Text Editor Java

Text edior in Java

Program Code for Java Text Editor :

 import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; //Texteditor class starts here class Texteditor extends Frame implements ActionListener < TextArea ta=new TextArea(); int i,len1,len,pos1; String str="",s3="",s2="",s4="",s32="",s6="",s7="",s8="",s9=""; String months[]=; CheckboxMenuItem chkb=new CheckboxMenuItem("Word Wrap"); public Texteditor() < MenuBar mb=new MenuBar(); setLayout(new BorderLayout()); add("Center",ta); setMenuBar(mb); Menu m1=new Menu("File"); Menu m2=new Menu("Edit"); Menu m3=new Menu("Tools"); Menu m4=new Menu("Help"); mb.add(m1); mb.add(m2); mb.add(m3); mb.add(m4); MenuItem mi1[]=< new MenuItem("New"),new MenuItem("Open"),new MenuItem("Save") ,new MenuItem("Save As"),new MenuItem("Page Setup") ,new MenuItem("Print"),new MenuItem("Exit") >; MenuItem mi2[]=; MenuItem mi3[]=; MenuItem mi4[]=; for(int i=0;i  < m1.add(mi1[i]); mi1[i].addActionListener(this); >for(int i=0;i m2.add(mi2[i]); mi2[i].addActionListener(this); > m3.add(chkb); chkb.addActionListener(this); for(int i=0;i  < m3.add(mi3[i]); mi3[i].addActionListener(this); >for(int i=0;i  < m4.add(mi4[i]); mi4[i].addActionListener(this); >MyWindowsAdapter mw=new MyWindowsAdapter(this); addWindowListener(mw); setSize(500,500); setTitle("untitled notepad"); setVisible(true); > public void actionPerformed(ActionEvent ae) < String arg=(String)ae.getActionCommand(); if(arg.equals("New")) < dispose(); Texteditor t11=new Texteditor(); t11.setSize(500,500); t11.setVisible(true); >try < if(arg.equals("Open")) < FileDialog fd1=new FileDialog(this,"Select File",FileDialog.LOAD); fd1.setVisible(true); String s4=""; s2=fd1.getFile(); s3=fd1.getDirectory(); s32=s3+s2; File f=new File(s32); FileInputStream fii=new FileInputStream(f); len=(int)f.length(); for(int j=0;j < char s5=(char)fii.read(); s4=s4 + s5; >ta.setText(s4); > > catch(IOException e) < >try < if(arg.equals("Save As")) < FileDialog dialog1=new FileDialog(this,"Save As",FileDialog.SAVE); dialog1.setVisible(true); s7=dialog1.getDirectory(); s8=dialog1.getFile(); s9=s7+s8+".txt"; s6=ta.getText(); len1=s6.length(); byte buf[]=s6.getBytes(); File f1=new File(s9); FileOutputStream fobj1=new FileOutputStream(f1); for(int k=0;k < fobj1.write(buf[k]); >fobj1.close(); > this.setTitle(s8 +" Texteditor File"); > catch(IOException e)<> if(arg.equals("Exit")) < System.exit(0); >if(arg.equals("Cut")) < str=ta.getSelectedText(); i=ta.getText().indexOf(str); ta.replaceRange(" ",i,i+str.length()); >if(arg.equals("Copy")) < str=ta.getSelectedText(); >if(arg.equals("Paste")) < pos1=ta.getCaretPosition(); ta.insert(str,pos1); >if(arg.equals("Delete")) < String msg=ta.getSelectedText(); i=ta.getText().indexOf(msg); ta.replaceRange(" ",i,i+msg.length()); msg=""; >if(arg.equals("Select All")) < String strText=ta.getText(); int strLen=strText.length(); ta.select(0,strLen); >if(arg.equals("Time Stamp")) < GregorianCalendar gcalendar=new GregorianCalendar(); String h=String.valueOf(gcalendar.get(Calendar.HOUR)); String m=String.valueOf(gcalendar.get(Calendar.MINUTE)); String s=String.valueOf(gcalendar.get(Calendar.SECOND)); String date=String.valueOf(gcalendar.get(Calendar.DATE)); String mon=months[gcalendar.get(Calendar.MONTH)]; String year=String.valueOf(gcalendar.get(Calendar.YEAR)); String hms="Time"+" - "+h+":"+m+":"+s+" Date"+" - "+date+" "+mon+" "+year+" "; int loc=ta.getCaretPosition(); ta.insert(hms,loc); >if(arg.equals("About Texteditor")) < AboutDialog d1=new AboutDialog(this,"About Texteditor"); d1.setVisible(true); setSize(500,500); >>//Action pereformed end public class MyWindowsAdapter extends WindowAdapter < Texteditor tt; public MyWindowsAdapter(Texteditor ttt) < tt=ttt; >public void windowClosing(WindowEvent we) < tt.dispose(); >>//Inner class winadapter end. >//End of Texteditor class public class balls < public static void main(String args[]) < Texteditor to=new Texteditor(); >> class AboutDialog extends Dialog implements ActionListener < AboutDialog(Frame parent,String title) < super(parent,title,false); this.setResizable(false); setLayout(new FlowLayout(FlowLayout.LEFT)); setSize(500,300); >public void actionPerformed(ActionEvent ae) < dispose(); >> 

How to Run this Project :

  • Open Eclipse
  • New Project
  • Add new Class to project
  • Paste Code in that class named Balls .
  • Run the Project …Enjoy.

Other Projects to Try:

Reader Interactions

Comments

Do we paste the whole code from before imports in that class or is it something else? Because when i pasted the whole code in the class Balls there were too many errors to ignore 😀

Just create a class name Texteditor in Eclipse or Netbeans and then paste paste this code inside that class.

You can download download this project, But you can copy the source code to create a text editor project using visual studio 6.0.

Источник

Читайте также:  Java error stream to file
Оцените статью