Notepad with awt
Checkout the notepad i have coded @easylearnjava.wordpress.com
import javax.swing.JFrame; public class Main { frame.setTitle("Notepad"); frame.setVisible(true); frame.setSize(1280, 720); frame.setResizable(true); frame.setLocationRelativeTo(null); } }
int fileToOpen; int fileToSave; JFileChooser fileOpen; JFileChooser fileSave;
Grid(){ setMenuBar(menuBar); menuBar.add(file); file.add(newOption); file.add(open); file.add(save); file.add(close); getContentPane().add(textArea); textArea.setText(""); } }); openFile(); textArea.setText(""); try{ while (scan.hasNext()) textArea.append(scan.nextLine()); } } } }); saveFile(); try { out.write(textArea.getText()); out.close(); } } } }); } }); }
public void openFile(){ int option = open.showOpenDialog(this); fileToOpen = option; fileOpen = open; } public void saveFile(){ int option = save.showOpenDialog(this); fileToSave = option; fileSave = save; }
import javax.swing.JFrame; public class Main { frame.setTitle("Notepad"); frame.setVisible(true); frame.setSize(1280, 720); frame.setResizable(true); frame.setLocationRelativeTo(null); } }
import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.util.Scanner; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JTextArea; int fileToOpen; int fileToSave; JFileChooser fileOpen; JFileChooser fileSave; Grid(){ setMenuBar(menuBar); menuBar.add(file); file.add(newOption); file.add(open); file.add(save); file.add(close); getContentPane().add(textArea); textArea.setText(""); } }); openFile(); textArea.setText(""); try{ while (scan.hasNext()) textArea.append(scan.nextLine()); } } } }); saveFile(); try { out.write(textArea.getText()); out.close(); } } } }); } }); } public void openFile(){ int option = open.showOpenDialog(this); fileToOpen = option; fileOpen = open; } public void saveFile(){ int option = save.showOpenDialog(this); fileToSave = option; fileSave = save; } }
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
good site. it is very usefull to all. thanks.
plz send me the full window notepad source code plzzzz email ID : [email protected]