Creating Text Editor in Java Java Java Projects Tools by Rajesh Kumar Sahanee - April 27, 2017September 11, 20170 Post Views: 9,876 Hello Friends, Today I am going to share Java Project (MyEditor) which I Developed long time ago. This Java project is nothing but a Text Editor, In this editor you can create and modify text file. Using this editor you can manipulate multiple files at once. There is some special features in this editor, which are listed below:- You can compile and run java files You can type in hindi also in this editor You can read live website url html code Modify multiple files at once So, Here is the code Main.java Main.java Java package jeditor; import java.awt.EventQueue; /** * * @author Rajesh Kumar Sahanee */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new Editor().setVisible(true); } }); } } 1234567891011121314151617181920212223 package jeditor; import java.awt.EventQueue; /** * * @author Rajesh Kumar Sahanee */public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new Editor().setVisible(true); } }); }} Area.java Area.java Java package jeditor; import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.border.EmptyBorder; import javax.swing.text.SimpleAttributeSet; /** * * @author Rajesh Kumar Sahanee */ class Area extends JScrollPane implements KeyListener { JTextPane jtp = new JTextPane(); JPanel panel = new JPanel(); SimpleAttributeSet attr = new SimpleAttributeSet(); Font font; boolean saved = false; boolean edited; boolean hindi = false; public int caretPosition,len; public boolean isEdited() { return edited; } public void setEdited(boolean edited) { this.edited = edited; } public void setSaved(boolean saved) { this.saved = saved; } public boolean isSaved() { return saved; } public boolean isHindi() { return hindi; } public void setHindi(boolean flag) { hindi = flag; } public Area() { initComponent(); } private void initComponent() { jtp.setBorder(new EmptyBorder(1, 1, 1, 1));//same border for synch list and jtp lines panel.setLayout(new BorderLayout()); panel.add(jtp, BorderLayout.CENTER); setViewportView(panel); setFont("Aerial", Font.PLAIN, 12); jtp.addKeyListener(this); } public JTextPane getArea() { return jtp; } public void setFont(String face, int style, int size) { font = new Font(face, style, size); jtp.setFont(font); } @Override public Font getFont(){ return font; } @Override public void keyTyped(KeyEvent e) { // jtp.getHighlighter().removeAllHighlights(); } @Override public void keyPressed(KeyEvent e) { //calculate caret position caretPosition = jtp.getCaretPosition(); len = jtp.getText().length(); setEdited(true); } @Override public void keyReleased(KeyEvent e) { //line count and update line numbers if (e.getKeyCode() != KeyEvent.VK_SPACE && e.getKeyCode() != KeyEvent.VK_LEFT && e.getKeyCode() != KeyEvent.VK_RIGHT && e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN && e.getKeyCode() != KeyEvent.VK_HOME && e.getKeyCode() != KeyEvent.VK_END && e.getKeyCode() != KeyEvent.VK_SHIFT && hindi) { String translated = Translator.toHindi(jtp.getText()); jtp.setText(translated); int len2 = translated.length(); if(caretPosition < jtp.getCaretPosition()){ jtp.setCaretPosition(caretPosition+(len2-len)); } } } } 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 package jeditor; import java.awt.BorderLayout;import java.awt.Font;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextPane;import javax.swing.border.EmptyBorder;import javax.swing.text.SimpleAttributeSet; /** * * @author Rajesh Kumar Sahanee */class Area extends JScrollPane implements KeyListener { JTextPane jtp = new JTextPane(); JPanel panel = new JPanel(); SimpleAttributeSet attr = new SimpleAttributeSet(); Font font; boolean saved = false; boolean edited; boolean hindi = false; public int caretPosition,len; public boolean isEdited() { return edited; } public void setEdited(boolean edited) { this.edited = edited; } public void setSaved(boolean saved) { this.saved = saved; } public boolean isSaved() { return saved; } public boolean isHindi() { return hindi; } public void setHindi(boolean flag) { hindi = flag; } public Area() { initComponent(); } private void initComponent() { jtp.setBorder(new EmptyBorder(1, 1, 1, 1));//same border for synch list and jtp lines panel.setLayout(new BorderLayout()); panel.add(jtp, BorderLayout.CENTER); setViewportView(panel); setFont("Aerial", Font.PLAIN, 12); jtp.addKeyListener(this); } public JTextPane getArea() { return jtp; } public void setFont(String face, int style, int size) { font = new Font(face, style, size); jtp.setFont(font); } @Override public Font getFont(){ return font; } @Override public void keyTyped(KeyEvent e) { // jtp.getHighlighter().removeAllHighlights(); } @Override public void keyPressed(KeyEvent e) { //calculate caret position caretPosition = jtp.getCaretPosition(); len = jtp.getText().length(); setEdited(true); } @Override public void keyReleased(KeyEvent e) { //line count and update line numbers if (e.getKeyCode() != KeyEvent.VK_SPACE && e.getKeyCode() != KeyEvent.VK_LEFT && e.getKeyCode() != KeyEvent.VK_RIGHT && e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN && e.getKeyCode() != KeyEvent.VK_HOME && e.getKeyCode() != KeyEvent.VK_END && e.getKeyCode() != KeyEvent.VK_SHIFT && hindi) { String translated = Translator.toHindi(jtp.getText()); jtp.setText(translated); int len2 = translated.length(); if(caretPosition < jtp.getCaretPosition()){ jtp.setCaretPosition(caretPosition+(len2-len)); } } } } Editor.java Editor.java Java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * @author Rajesh Kumar Sahanee * * Created on Aug 12, 2012, 9:16:46 PM */ package jeditor; import java.awt.Color; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.text.DefaultHighlighter; import javax.swing.text.Highlighter; /** * * @author Rajesh */ public class Editor extends javax.swing.JFrame implements WindowListener { /** * Creates new form Editor */ public Editor() { setIconImage(new ImageIcon(getClass().getResource("/img/logo.gif")).getImage()); initComponents(); area = new Area(); addTab("Untitled", area); addWindowListener(this); output.setVisible(false); startCounter(); } private void startCounter(){ new Thread(){ @Override public void run(){ String text=""; int lastp = 0; while(running){ if(area!=null){ try{ text = "Total Line: "+ area.getArea().getText().split("\n").length+" | "; text += "Line: "+area.getArea().getText(0, area.getArea().getCaretPosition()).split("\n").length+" | "; if (area.getArea().getText().lastIndexOf("\n", area.getArea().getCaretPosition()) > 0) { lastp = area.getArea().getText(0, area.getArea().getCaretPosition()).lastIndexOf("\n"); text += "Character: " + (area.getArea().getCaretPosition() - lastp); } else { text += "Character: " + (area.getArea().getCaretPosition()+1); } linecurL.setText(text); Thread.sleep(10); }catch(Exception e){} } } } }.start(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { topToolbar = new javax.swing.JToolBar(); filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0)); newB = new javax.swing.JButton(); filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); openB = new javax.swing.JButton(); saveB = new javax.swing.JButton(); cutB = new javax.swing.JButton(); copyB = new javax.swing.JButton(); pasteB = new javax.swing.JButton(); compileB = new javax.swing.JButton(); runB = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); fontSizeC = new javax.swing.JComboBox(); jSeparator2 = new javax.swing.JToolBar.Separator(); fontStyleC = new javax.swing.JComboBox(); jSeparator3 = new javax.swing.JToolBar.Separator(); langB = new javax.swing.JButton(); hmapB = new javax.swing.JButton(); jSeparator4 = new javax.swing.JToolBar.Separator(); findT = new javax.swing.JTextField(); jSeparator5 = new javax.swing.JToolBar.Separator(); findPB = new javax.swing.JButton(); findNB = new javax.swing.JButton(); jSeparator8 = new javax.swing.JToolBar.Separator(); showReplace = new javax.swing.JButton(); jSeparator6 = new javax.swing.JToolBar.Separator(); readUrlB = new javax.swing.JButton(); pbar = new javax.swing.JProgressBar(); jSeparator9 = new javax.swing.JToolBar.Separator(); aboutB = new javax.swing.JButton(); jSeparator10 = new javax.swing.JToolBar.Separator(); showOutputB = new javax.swing.JButton(); jSeparator7 = new javax.swing.JToolBar.Separator(); closeB = new javax.swing.JButton(); workArea = new javax.swing.JTabbedPane(); bottomContainer = new javax.swing.JPanel(); jToolBar2 = new javax.swing.JToolBar(); jLabel2 = new javax.swing.JLabel(); replaceWhatT = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); replaceWithT = new javax.swing.JTextField(); replaceB = new javax.swing.JButton(); replaceAllB = new javax.swing.JButton(); output = new javax.swing.JToolBar(); jTabbedPane1 = new javax.swing.JTabbedPane(); jScrollPane2 = new javax.swing.JScrollPane(); outputT = new javax.swing.JTextArea(); linecurL = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("My Editor"); setBounds(new java.awt.Rectangle(0, 0, 600, 0)); setIconImage(new ImageIcon(getClass().getResource("/img/logo.png")).getImage()); setMinimumSize(new java.awt.Dimension(600, 450)); topToolbar.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(204, 204, 255), null)); topToolbar.setFloatable(false); topToolbar.setRollover(true); topToolbar.add(filler1); newB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/newb.png"))); // NOI18N newB.setMnemonic('N'); newB.setToolTipText("Create new file (Alt+N)"); newB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); newB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); newB.setFocusable(false); newB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); newB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); newB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newBActionPerformed(evt); } }); topToolbar.add(newB); topToolbar.add(filler2); openB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/openb.png"))); // NOI18N openB.setMnemonic('O'); openB.setToolTipText("Open file (Alt+O)"); openB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); openB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); openB.setFocusable(false); openB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); openB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); openB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openBActionPerformed(evt); } }); topToolbar.add(openB); saveB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/saveb.png"))); // NOI18N saveB.setMnemonic('S'); saveB.setToolTipText("Save file (Alt+S)"); saveB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); saveB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); saveB.setFocusable(false); saveB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); saveB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); saveB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveBActionPerformed(evt); } }); topToolbar.add(saveB); cutB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/cutb.png"))); // NOI18N cutB.setMnemonic('X'); cutB.setToolTipText("Cut (Alt+X)"); cutB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); cutB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); cutB.setFocusable(false); cutB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cutB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cutB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cutBActionPerformed(evt); } }); topToolbar.add(cutB); copyB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/copyb.png"))); // NOI18N copyB.setMnemonic('C'); copyB.setToolTipText("Copy (Alt+C)"); copyB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); copyB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); copyB.setFocusable(false); copyB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); copyB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); copyB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copyBActionPerformed(evt); } }); topToolbar.add(copyB); pasteB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/pasteb.png"))); // NOI18N pasteB.setMnemonic('P'); pasteB.setToolTipText("Paste (Alt+P)"); pasteB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); pasteB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); pasteB.setFocusable(false); pasteB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); pasteB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); pasteB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pasteBActionPerformed(evt); } }); topToolbar.add(pasteB); compileB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/compileb.png"))); // NOI18N compileB.setToolTipText("Compile"); compileB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); compileB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); compileB.setFocusable(false); compileB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); compileB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); compileB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { compileBActionPerformed(evt); } }); topToolbar.add(compileB); runB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/runb.png"))); // NOI18N runB.setToolTipText("Run"); runB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); runB.setFocusable(false); runB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); runB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); runB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { runBActionPerformed(evt); } }); topToolbar.add(runB); topToolbar.add(jSeparator1); fontSizeC.setEditable(true); fontSizeC.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "3", "7", "12", "16", "24", "28", "32", "36" })); fontSizeC.setSelectedItem(12); fontSizeC.setToolTipText("Font Size"); fontSizeC.setMaximumSize(new java.awt.Dimension(32767, 28)); fontSizeC.setMinimumSize(new java.awt.Dimension(93, 28)); fontSizeC.setPreferredSize(new java.awt.Dimension(98, 28)); fontSizeC.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontSizeCActionPerformed(evt); } }); topToolbar.add(fontSizeC); topToolbar.add(jSeparator2); fontStyleC.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Plain", "Bold", "Italic" })); fontStyleC.setToolTipText("Font Style"); fontStyleC.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); fontStyleC.setFocusable(false); fontStyleC.setMaximumSize(new java.awt.Dimension(32767, 28)); fontStyleC.setMinimumSize(new java.awt.Dimension(93, 28)); fontStyleC.setPreferredSize(new java.awt.Dimension(98, 28)); fontStyleC.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontStyleCActionPerformed(evt); } }); topToolbar.add(fontStyleC); topToolbar.add(jSeparator3); langB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/abc.png"))); // NOI18N langB.setToolTipText("English"); langB.setFocusable(false); langB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); langB.setMaximumSize(new java.awt.Dimension(29, 29)); langB.setMinimumSize(new java.awt.Dimension(29, 29)); langB.setPreferredSize(new java.awt.Dimension(29, 29)); langB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { langBActionPerformed(evt); } }); topToolbar.add(langB); hmapB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/map.png"))); // NOI18N hmapB.setToolTipText("Hindi Map"); hmapB.setEnabled(false); hmapB.setFocusable(false); hmapB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); hmapB.setMaximumSize(new java.awt.Dimension(29, 29)); hmapB.setMinimumSize(new java.awt.Dimension(29, 29)); hmapB.setPreferredSize(new java.awt.Dimension(29, 29)); hmapB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); hmapB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { hmapBActionPerformed(evt); } }); topToolbar.add(hmapB); topToolbar.add(jSeparator4); findT.setColumns(25); findT.setFont(new java.awt.Font("Nyala", 0, 18)); // NOI18N findT.setToolTipText("Find Text"); findT.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); findT.setMaximumSize(new java.awt.Dimension(2147483647, 28)); findT.setMinimumSize(new java.awt.Dimension(6, 28)); findT.setPreferredSize(new java.awt.Dimension(331, 28)); findT.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { findTKeyReleased(evt); } }); topToolbar.add(findT); topToolbar.add(jSeparator5); findPB.setFont(new java.awt.Font("Segoe Script", 1, 24)); // NOI18N findPB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/fprevious.png"))); // NOI18N findPB.setToolTipText("Find Backward"); findPB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); findPB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); findPB.setFocusable(false); findPB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); findPB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); findPB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { findPBActionPerformed(evt); } }); topToolbar.add(findPB); findNB.setFont(new java.awt.Font("Segoe Script", 1, 24)); // NOI18N findNB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/fnext.png"))); // NOI18N findNB.setToolTipText("Find Forward"); findNB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); findNB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); findNB.setFocusable(false); findNB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); findNB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); findNB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { findNBActionPerformed(evt); } }); topToolbar.add(findNB); topToolbar.add(jSeparator8); showReplace.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/findreplaceb.png"))); // NOI18N showReplace.setMnemonic('H'); showReplace.setToolTipText("Replace (Alt+H)"); showReplace.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); showReplace.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); showReplace.setFocusable(false); showReplace.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); showReplace.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); showReplace.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showReplaceActionPerformed(evt); } }); topToolbar.add(showReplace); topToolbar.add(jSeparator6); readUrlB.setFont(new java.awt.Font("Tahoma", 3, 12)); // NOI18N readUrlB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/urlreaderb.png"))); // NOI18N readUrlB.setMnemonic('U'); readUrlB.setToolTipText("Read Url (Alt+U)"); readUrlB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); readUrlB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); readUrlB.setFocusable(false); readUrlB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); readUrlB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); readUrlB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { readUrlBActionPerformed(evt); } }); topToolbar.add(readUrlB); pbar.setValue(100); pbar.setMaximumSize(new java.awt.Dimension(50, 22)); pbar.setMinimumSize(new java.awt.Dimension(50, 22)); pbar.setPreferredSize(new java.awt.Dimension(50, 22)); pbar.setString("Reading"); topToolbar.add(pbar); topToolbar.add(jSeparator9); aboutB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/aboutb.png"))); // NOI18N aboutB.setToolTipText("About"); aboutB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); aboutB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); aboutB.setFocusable(false); aboutB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); aboutB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); aboutB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { aboutBActionPerformed(evt); } }); topToolbar.add(aboutB); topToolbar.add(jSeparator10); showOutputB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/showhide.png"))); // NOI18N showOutputB.setToolTipText("Show/Hide Output"); showOutputB.setFocusable(false); showOutputB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); showOutputB.setMaximumSize(new java.awt.Dimension(29, 29)); showOutputB.setMinimumSize(new java.awt.Dimension(29, 29)); showOutputB.setPreferredSize(new java.awt.Dimension(29, 29)); showOutputB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); showOutputB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showOutputBActionPerformed(evt); } }); topToolbar.add(showOutputB); topToolbar.add(jSeparator7); closeB.setFont(new java.awt.Font("Ebrima", 1, 22)); // NOI18N closeB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/closeb.png"))); // NOI18N closeB.setMnemonic('E'); closeB.setToolTipText("Close (Alt+E)"); closeB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); closeB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); closeB.setFocusable(false); closeB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); closeB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); closeB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { closeBActionPerformed(evt); } }); topToolbar.add(closeB); getContentPane().add(topToolbar, java.awt.BorderLayout.NORTH); workArea.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); workArea.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { workAreaMouseClicked(evt); } }); getContentPane().add(workArea, java.awt.BorderLayout.CENTER); bottomContainer.setLayout(new java.awt.BorderLayout()); jToolBar2.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(204, 204, 255), null)); jToolBar2.setFloatable(false); jToolBar2.setRollover(true); jToolBar2.setPreferredSize(new java.awt.Dimension(227, 23)); jLabel2.setText(" What: "); jToolBar2.add(jLabel2); replaceWhatT.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N replaceWhatT.setMinimumSize(new java.awt.Dimension(6, 26)); replaceWhatT.setPreferredSize(new java.awt.Dimension(6, 10)); jToolBar2.add(replaceWhatT); jLabel1.setText(" Replace with: "); jToolBar2.add(jLabel1); replaceWithT.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N replaceWithT.setMinimumSize(new java.awt.Dimension(6, 26)); jToolBar2.add(replaceWithT); replaceB.setText("Replace"); replaceB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); replaceB.setFocusable(false); replaceB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); replaceB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); replaceB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceBActionPerformed(evt); } }); jToolBar2.add(replaceB); replaceAllB.setText("Replace All"); replaceAllB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); replaceAllB.setFocusable(false); replaceAllB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); replaceAllB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); replaceAllB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceAllBActionPerformed(evt); } }); jToolBar2.add(replaceAllB); bottomContainer.add(jToolBar2, java.awt.BorderLayout.NORTH); jToolBar2.setVisible(false); output.setFloatable(false); output.setRollover(true); output.setToolTipText("Output"); output.setMaximumSize(new java.awt.Dimension(32780, 100)); output.setName("Output"); // NOI18N output.setPreferredSize(new java.awt.Dimension(113, 100)); outputT.setColumns(20); outputT.setRows(5); jScrollPane2.setViewportView(outputT); jTabbedPane1.addTab("Output", jScrollPane2); output.add(jTabbedPane1); bottomContainer.add(output, java.awt.BorderLayout.CENTER); linecurL.setText("Total Line: 50; Current Line: 25; Character: 10;"); bottomContainer.add(linecurL, java.awt.BorderLayout.PAGE_END); getContentPane().add(bottomContainer, java.awt.BorderLayout.PAGE_END); pack(); }// </editor-fold> private void openBActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser jfc = new JFileChooser(); int response = jfc.showOpenDialog(this); if (response == JFileChooser.APPROVE_OPTION) { try { file = jfc.getSelectedFile();//future check FileInputStream fis = new FileInputStream(file); byte b[] = new byte[fis.available()]; fis.read(b); String str = new String(b); area = new Area(); area.setFont("Aerial", fontStyleC.getSelectedIndex(), Integer.parseInt(String.valueOf(fontSizeC.getSelectedItem()))); area.getArea().setText(str); String name = file.toString(); addTab(name, area); area.setEdited(false); area.setSaved(true); } catch (Exception e) { JOptionPane.showMessageDialog(this, "File Cannot Open"); } } } private void newBActionPerformed(java.awt.event.ActionEvent evt) { area = new Area(); area.setFont("Aerial", fontStyleC.getSelectedIndex(), Integer.parseInt(String.valueOf(fontSizeC.getSelectedItem()))); addTab("Untitled", area); } private void aboutBActionPerformed(java.awt.event.ActionEvent evt) { visible = !visible; aboutWin.setLocation(-aboutWin.getWidth() / 2 + this.getWidth() / 2, this.getY() - aboutWin.getHeight() / 2 + this.getHeight() / 2); aboutWin.setVisible(visible); } private void saveBActionPerformed(java.awt.event.ActionEvent evt) { save(); } private void closeBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); if (area != null) { if (area.isEdited()) { int response = JOptionPane.showConfirmDialog(rootPane, "Do you want to Save Changes"); if (JOptionPane.YES_OPTION == response) { save(); workArea.removeTabAt(workArea.getSelectedIndex()); } else if (JOptionPane.NO_OPTION == response) { workArea.removeTabAt(workArea.getSelectedIndex()); } } else { workArea.removeTabAt(workArea.getSelectedIndex()); } } else { JOptionPane.showMessageDialog(rootPane, "There is no any opened document!"); } } private void cutBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); area.getArea().cut(); } private void copyBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); area.getArea().copy(); } private void pasteBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); area.getArea().paste(); } private void findNBActionPerformed(java.awt.event.ActionEvent evt) { find(findT.getText(), pos, 1); } private void findPBActionPerformed(java.awt.event.ActionEvent evt) { find(findT.getText(), pos, -1); } private void workAreaMouseClicked(java.awt.event.MouseEvent evt) { area = (Area) workArea.getSelectedComponent(); String size = String.valueOf(area.getFont().getSize()); fontStyleC.setSelectedIndex(area.getFont().getStyle()); fontSizeC.setSelectedItem(size); } private void findTKeyReleased(java.awt.event.KeyEvent evt) { if (area.isHindi()) { area.getArea().getHighlighter().removeAllHighlights(); findAll(Translator.toHindi(findT.getText()), 0); } else { area.getArea().getHighlighter().removeAllHighlights(); findAll(findT.getText(), 0); } } private void readUrlBActionPerformed(java.awt.event.ActionEvent evt) { new Thread() { @Override public void run() { try { String path = JOptionPane.showInputDialog("Enter Url"); if (!path.startsWith("http://")) { path = "http://" + path; } new Thread() { @Override public void run() { int i = 0; pbar.setStringPainted(true); while (!taskDone) { if (i == 100) { i = 0; } pbar.setValue(i); i += 5; try { Thread.sleep(50); } catch (InterruptedException e) { } } pbar.setValue(100); pbar.setStringPainted(false); taskDone = false; } }.start(); URL url = new URL(path); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String read = null; String content = ""; while ((read = br.readLine()) != null) { content = content + read + "\n"; } br.close(); area = new Area(); area.getArea().setText(content); workArea.addTab(url.toString(), area); workArea.setSelectedIndex(workArea.getTabCount() - 1); taskDone = true; } catch (Exception ex) { taskDone = true; JOptionPane.showMessageDialog(null, ex); } } }.start(); } private void showReplaceActionPerformed(java.awt.event.ActionEvent evt) { visible = !visible; jToolBar2.setVisible(visible); replaceWhatT.setText(findT.getText()); } private void replaceBActionPerformed(java.awt.event.ActionEvent evt) { String string = area.getArea().getText(); string = string.replaceFirst(replaceWhatT.getText(), replaceWithT.getText()); area.getArea().setText(string); } private void replaceAllBActionPerformed(java.awt.event.ActionEvent evt) { String string = area.getArea().getText(); string = string.replaceAll(replaceWhatT.getText(), replaceWithT.getText()); area.getArea().setText(string); } private void fontSizeCActionPerformed(java.awt.event.ActionEvent evt) { try { int size = Integer.parseInt(String.valueOf(fontSizeC.getSelectedItem())); int style = fontStyleC.getSelectedIndex(); area.setFont("Aerial", style, size); } catch (Exception e) { fontSizeC.setSelectedIndex(2); } } private void fontStyleCActionPerformed(java.awt.event.ActionEvent evt) { int size = Integer.parseInt((String.valueOf(fontSizeC.getSelectedItem()))); int style = fontStyleC.getSelectedIndex(); area.setFont("Aerial", style, size); } private void compileBActionPerformed(java.awt.event.ActionEvent evt) { try { save(); if (area.isSaved()) { if(workArea.getTitleAt(workArea.getSelectedIndex()).lastIndexOf(".java")>0){ Runtime runtime = Runtime.getRuntime(); runtime.exec("javac " + workArea.getTitleAt(workArea.getSelectedIndex())); outputT.setText("Compiled Successfully"); }else{ outputT.setText("File Should be of .java extension"); } } else { outputT.setText("Cannot compile unsaved file"); } } catch (Exception ex) { outputT.setText("Error in Compilation! " + ex); } } private void runBActionPerformed(java.awt.event.ActionEvent evt) { save(); new Thread() { @Override public void run() { try { Runtime rt = Runtime.getRuntime(); String location = workArea.getTitleAt(workArea.getSelectedIndex()); String fl = location.substring(location.lastIndexOf("\\") + 1, location.lastIndexOf(".")); location = location.substring(0, location.lastIndexOf("\\")); Process pr = rt.exec("java -classpath \"" + location + "\" " + fl); BufferedReader br = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line; outputT.setText(""); while ((line = br.readLine()) != null) { outputT.setText(outputT.getText() + line + "\n"); } } catch (IOException ex) { outputT.setText(ex.toString()); } } }.start(); } private void langBActionPerformed(java.awt.event.ActionEvent evt) { if (area.isHindi()) { langB.setToolTipText("English"); area.setHindi(false); hmapB.setEnabled(false); langB.setIcon(new ImageIcon(getClass().getResource("/img/abc.png"))); } else { langB.setToolTipText("Hindi"); area.setHindi(true); hmapB.setEnabled(true); langB.setIcon(new ImageIcon(getClass().getResource("/img/a.png"))); } } private void hmapBActionPerformed(java.awt.event.ActionEvent evt) { if (hMap == null) { hMap = new HindiMap(); } if (hMap.isVisible()) { hMap.setVisible(false); } else { hMap.setVisible(true); } } private void showOutputBActionPerformed(java.awt.event.ActionEvent evt) { if (output.isVisible()) { output.setVisible(false); } else { output.setVisible(true); } } public void find(String search, int pos, int d) { area.getArea().getHighlighter().removeAllHighlights(); if (d == 1) { pos = area.getArea().getText().replaceAll("\n", "").indexOf(search, pos); }//replaceAll to remove new lines character if (d == -1) { pos = area.getArea().getText().replaceAll("\n", "").lastIndexOf(search, pos); } if (pos >= 0) { try { Highlighter h = area.getArea().getHighlighter(); h.addHighlight(pos, pos + search.length(), new DefaultHighlighter.DefaultHighlightPainter(Color.GREEN)); } catch (Exception ex) { JOptionPane.showMessageDialog(area.getArea(), ex); } if (d == -1) { this.pos = pos - search.length(); } if (d == 1) { this.pos = pos + search.length(); } } } public void findAll(String search, int pos) { pos = area.getArea().getText().replaceAll("\n", "").indexOf(search, pos);//replaceAll to remove new lines character if (pos >= 0 && search.length() > 0) { try { Highlighter h = area.getArea().getHighlighter(); h.addHighlight(pos, pos + search.length(), new DefaultHighlighter.DefaultHighlightPainter(Color.GREEN)); } catch (Exception ex) { JOptionPane.showMessageDialog(area.getArea(), ex); } pos += search.length(); if (pos < area.getArea().getText().length()) { findAll(search, pos); }//recursion } } public void save() { JFileChooser jfc = new JFileChooser(); area = (Area) workArea.getSelectedComponent(); if (!area.isSaved()) { int response = jfc.showSaveDialog(this); if (response == JFileChooser.APPROVE_OPTION) { file = jfc.getSelectedFile(); if (file.exists()) { response = JOptionPane.showConfirmDialog(this, "File allready exists, Dou you want to overrite"); if (response == JOptionPane.YES_OPTION) { write(area); } else if (response == JOptionPane.NO_OPTION) { save(); } } else if (!file.exists()) { write(area); } area.setSaved(true); } } else { write(area); } } private void write(Area area) { try { String str = area.getArea().getText(); pw = new PrintWriter(new FileOutputStream(file)); pw.write(str); pw.flush(); String name = file.toString(); //name = name.substring(name.lastIndexOf("\\") + 1, name.length()); workArea.setTitleAt(workArea.getSelectedIndex(), name); area.setEdited(false); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Cannot Save"); } } private void addTab(String title, Area area) { workArea.addTab(title, area); workArea.setSelectedIndex(workArea.getTabCount() - 1); } boolean taskDone = false; boolean running = true; private HindiMap hMap; private PrintWriter pw; private File file; private Area area; private int pos; private boolean visible; private About aboutWin = new About(); boolean closeAll = false; // Variables declaration - do not modify private javax.swing.JButton aboutB; private javax.swing.JPanel bottomContainer; private javax.swing.JButton closeB; private javax.swing.JButton compileB; private javax.swing.JButton copyB; private javax.swing.JButton cutB; private javax.swing.Box.Filler filler1; private javax.swing.Box.Filler filler2; private javax.swing.JButton findNB; private javax.swing.JButton findPB; private javax.swing.JTextField findT; private javax.swing.JComboBox fontSizeC; private javax.swing.JComboBox fontStyleC; private javax.swing.JButton hmapB; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JToolBar.Separator jSeparator1; private javax.swing.JToolBar.Separator jSeparator10; private javax.swing.JToolBar.Separator jSeparator2; private javax.swing.JToolBar.Separator jSeparator3; private javax.swing.JToolBar.Separator jSeparator4; private javax.swing.JToolBar.Separator jSeparator5; private javax.swing.JToolBar.Separator jSeparator6; private javax.swing.JToolBar.Separator jSeparator7; private javax.swing.JToolBar.Separator jSeparator8; private javax.swing.JToolBar.Separator jSeparator9; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JToolBar jToolBar2; private javax.swing.JButton langB; private javax.swing.JLabel linecurL; private javax.swing.JButton newB; private javax.swing.JButton openB; private javax.swing.JToolBar output; private javax.swing.JTextArea outputT; private javax.swing.JButton pasteB; private javax.swing.JProgressBar pbar; private javax.swing.JButton readUrlB; private javax.swing.JButton replaceAllB; private javax.swing.JButton replaceB; private javax.swing.JTextField replaceWhatT; private javax.swing.JTextField replaceWithT; private javax.swing.JButton runB; private javax.swing.JButton saveB; private javax.swing.JButton showOutputB; private javax.swing.JButton showReplace; private javax.swing.JToolBar topToolbar; private javax.swing.JTabbedPane workArea; // End of variables declaration @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { closeAll = true; running = false; } @Override public void windowClosed(WindowEvent e) { System.exit(0); } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } } 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984 /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * @author Rajesh Kumar Sahanee * * Created on Aug 12, 2012, 9:16:46 PM */package jeditor; import java.awt.Color;import java.awt.event.WindowEvent;import java.awt.event.WindowListener;import java.io.BufferedReader;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStreamReader;import java.io.PrintWriter;import java.net.URL;import javax.swing.ImageIcon;import javax.swing.JFileChooser;import javax.swing.JOptionPane;import javax.swing.text.DefaultHighlighter;import javax.swing.text.Highlighter; /** * * @author Rajesh */public class Editor extends javax.swing.JFrame implements WindowListener { /** * Creates new form Editor */ public Editor() { setIconImage(new ImageIcon(getClass().getResource("/img/logo.gif")).getImage()); initComponents(); area = new Area(); addTab("Untitled", area); addWindowListener(this); output.setVisible(false); startCounter(); } private void startCounter(){ new Thread(){ @Override public void run(){ String text=""; int lastp = 0; while(running){ if(area!=null){ try{ text = "Total Line: "+ area.getArea().getText().split("\n").length+" | "; text += "Line: "+area.getArea().getText(0, area.getArea().getCaretPosition()).split("\n").length+" | "; if (area.getArea().getText().lastIndexOf("\n", area.getArea().getCaretPosition()) > 0) { lastp = area.getArea().getText(0, area.getArea().getCaretPosition()).lastIndexOf("\n"); text += "Character: " + (area.getArea().getCaretPosition() - lastp); } else { text += "Character: " + (area.getArea().getCaretPosition()+1); } linecurL.setText(text); Thread.sleep(10); }catch(Exception e){} } } } }.start(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { topToolbar = new javax.swing.JToolBar(); filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0)); newB = new javax.swing.JButton(); filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); openB = new javax.swing.JButton(); saveB = new javax.swing.JButton(); cutB = new javax.swing.JButton(); copyB = new javax.swing.JButton(); pasteB = new javax.swing.JButton(); compileB = new javax.swing.JButton(); runB = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); fontSizeC = new javax.swing.JComboBox(); jSeparator2 = new javax.swing.JToolBar.Separator(); fontStyleC = new javax.swing.JComboBox(); jSeparator3 = new javax.swing.JToolBar.Separator(); langB = new javax.swing.JButton(); hmapB = new javax.swing.JButton(); jSeparator4 = new javax.swing.JToolBar.Separator(); findT = new javax.swing.JTextField(); jSeparator5 = new javax.swing.JToolBar.Separator(); findPB = new javax.swing.JButton(); findNB = new javax.swing.JButton(); jSeparator8 = new javax.swing.JToolBar.Separator(); showReplace = new javax.swing.JButton(); jSeparator6 = new javax.swing.JToolBar.Separator(); readUrlB = new javax.swing.JButton(); pbar = new javax.swing.JProgressBar(); jSeparator9 = new javax.swing.JToolBar.Separator(); aboutB = new javax.swing.JButton(); jSeparator10 = new javax.swing.JToolBar.Separator(); showOutputB = new javax.swing.JButton(); jSeparator7 = new javax.swing.JToolBar.Separator(); closeB = new javax.swing.JButton(); workArea = new javax.swing.JTabbedPane(); bottomContainer = new javax.swing.JPanel(); jToolBar2 = new javax.swing.JToolBar(); jLabel2 = new javax.swing.JLabel(); replaceWhatT = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); replaceWithT = new javax.swing.JTextField(); replaceB = new javax.swing.JButton(); replaceAllB = new javax.swing.JButton(); output = new javax.swing.JToolBar(); jTabbedPane1 = new javax.swing.JTabbedPane(); jScrollPane2 = new javax.swing.JScrollPane(); outputT = new javax.swing.JTextArea(); linecurL = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("My Editor"); setBounds(new java.awt.Rectangle(0, 0, 600, 0)); setIconImage(new ImageIcon(getClass().getResource("/img/logo.png")).getImage()); setMinimumSize(new java.awt.Dimension(600, 450)); topToolbar.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(204, 204, 255), null)); topToolbar.setFloatable(false); topToolbar.setRollover(true); topToolbar.add(filler1); newB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/newb.png"))); // NOI18N newB.setMnemonic('N'); newB.setToolTipText("Create new file (Alt+N)"); newB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); newB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); newB.setFocusable(false); newB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); newB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); newB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newBActionPerformed(evt); } }); topToolbar.add(newB); topToolbar.add(filler2); openB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/openb.png"))); // NOI18N openB.setMnemonic('O'); openB.setToolTipText("Open file (Alt+O)"); openB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); openB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); openB.setFocusable(false); openB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); openB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); openB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openBActionPerformed(evt); } }); topToolbar.add(openB); saveB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/saveb.png"))); // NOI18N saveB.setMnemonic('S'); saveB.setToolTipText("Save file (Alt+S)"); saveB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); saveB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); saveB.setFocusable(false); saveB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); saveB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); saveB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveBActionPerformed(evt); } }); topToolbar.add(saveB); cutB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/cutb.png"))); // NOI18N cutB.setMnemonic('X'); cutB.setToolTipText("Cut (Alt+X)"); cutB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); cutB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); cutB.setFocusable(false); cutB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cutB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cutB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cutBActionPerformed(evt); } }); topToolbar.add(cutB); copyB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/copyb.png"))); // NOI18N copyB.setMnemonic('C'); copyB.setToolTipText("Copy (Alt+C)"); copyB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); copyB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); copyB.setFocusable(false); copyB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); copyB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); copyB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copyBActionPerformed(evt); } }); topToolbar.add(copyB); pasteB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/pasteb.png"))); // NOI18N pasteB.setMnemonic('P'); pasteB.setToolTipText("Paste (Alt+P)"); pasteB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); pasteB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); pasteB.setFocusable(false); pasteB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); pasteB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); pasteB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pasteBActionPerformed(evt); } }); topToolbar.add(pasteB); compileB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/compileb.png"))); // NOI18N compileB.setToolTipText("Compile"); compileB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); compileB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); compileB.setFocusable(false); compileB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); compileB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); compileB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { compileBActionPerformed(evt); } }); topToolbar.add(compileB); runB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/runb.png"))); // NOI18N runB.setToolTipText("Run"); runB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); runB.setFocusable(false); runB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); runB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); runB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { runBActionPerformed(evt); } }); topToolbar.add(runB); topToolbar.add(jSeparator1); fontSizeC.setEditable(true); fontSizeC.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "3", "7", "12", "16", "24", "28", "32", "36" })); fontSizeC.setSelectedItem(12); fontSizeC.setToolTipText("Font Size"); fontSizeC.setMaximumSize(new java.awt.Dimension(32767, 28)); fontSizeC.setMinimumSize(new java.awt.Dimension(93, 28)); fontSizeC.setPreferredSize(new java.awt.Dimension(98, 28)); fontSizeC.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontSizeCActionPerformed(evt); } }); topToolbar.add(fontSizeC); topToolbar.add(jSeparator2); fontStyleC.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Plain", "Bold", "Italic" })); fontStyleC.setToolTipText("Font Style"); fontStyleC.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); fontStyleC.setFocusable(false); fontStyleC.setMaximumSize(new java.awt.Dimension(32767, 28)); fontStyleC.setMinimumSize(new java.awt.Dimension(93, 28)); fontStyleC.setPreferredSize(new java.awt.Dimension(98, 28)); fontStyleC.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontStyleCActionPerformed(evt); } }); topToolbar.add(fontStyleC); topToolbar.add(jSeparator3); langB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/abc.png"))); // NOI18N langB.setToolTipText("English"); langB.setFocusable(false); langB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); langB.setMaximumSize(new java.awt.Dimension(29, 29)); langB.setMinimumSize(new java.awt.Dimension(29, 29)); langB.setPreferredSize(new java.awt.Dimension(29, 29)); langB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { langBActionPerformed(evt); } }); topToolbar.add(langB); hmapB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/map.png"))); // NOI18N hmapB.setToolTipText("Hindi Map"); hmapB.setEnabled(false); hmapB.setFocusable(false); hmapB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); hmapB.setMaximumSize(new java.awt.Dimension(29, 29)); hmapB.setMinimumSize(new java.awt.Dimension(29, 29)); hmapB.setPreferredSize(new java.awt.Dimension(29, 29)); hmapB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); hmapB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { hmapBActionPerformed(evt); } }); topToolbar.add(hmapB); topToolbar.add(jSeparator4); findT.setColumns(25); findT.setFont(new java.awt.Font("Nyala", 0, 18)); // NOI18N findT.setToolTipText("Find Text"); findT.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); findT.setMaximumSize(new java.awt.Dimension(2147483647, 28)); findT.setMinimumSize(new java.awt.Dimension(6, 28)); findT.setPreferredSize(new java.awt.Dimension(331, 28)); findT.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { findTKeyReleased(evt); } }); topToolbar.add(findT); topToolbar.add(jSeparator5); findPB.setFont(new java.awt.Font("Segoe Script", 1, 24)); // NOI18N findPB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/fprevious.png"))); // NOI18N findPB.setToolTipText("Find Backward"); findPB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); findPB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); findPB.setFocusable(false); findPB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); findPB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); findPB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { findPBActionPerformed(evt); } }); topToolbar.add(findPB); findNB.setFont(new java.awt.Font("Segoe Script", 1, 24)); // NOI18N findNB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/fnext.png"))); // NOI18N findNB.setToolTipText("Find Forward"); findNB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); findNB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); findNB.setFocusable(false); findNB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); findNB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); findNB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { findNBActionPerformed(evt); } }); topToolbar.add(findNB); topToolbar.add(jSeparator8); showReplace.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/findreplaceb.png"))); // NOI18N showReplace.setMnemonic('H'); showReplace.setToolTipText("Replace (Alt+H)"); showReplace.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); showReplace.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); showReplace.setFocusable(false); showReplace.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); showReplace.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); showReplace.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showReplaceActionPerformed(evt); } }); topToolbar.add(showReplace); topToolbar.add(jSeparator6); readUrlB.setFont(new java.awt.Font("Tahoma", 3, 12)); // NOI18N readUrlB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/urlreaderb.png"))); // NOI18N readUrlB.setMnemonic('U'); readUrlB.setToolTipText("Read Url (Alt+U)"); readUrlB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); readUrlB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); readUrlB.setFocusable(false); readUrlB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); readUrlB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); readUrlB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { readUrlBActionPerformed(evt); } }); topToolbar.add(readUrlB); pbar.setValue(100); pbar.setMaximumSize(new java.awt.Dimension(50, 22)); pbar.setMinimumSize(new java.awt.Dimension(50, 22)); pbar.setPreferredSize(new java.awt.Dimension(50, 22)); pbar.setString("Reading"); topToolbar.add(pbar); topToolbar.add(jSeparator9); aboutB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/aboutb.png"))); // NOI18N aboutB.setToolTipText("About"); aboutB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); aboutB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); aboutB.setFocusable(false); aboutB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); aboutB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); aboutB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { aboutBActionPerformed(evt); } }); topToolbar.add(aboutB); topToolbar.add(jSeparator10); showOutputB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/showhide.png"))); // NOI18N showOutputB.setToolTipText("Show/Hide Output"); showOutputB.setFocusable(false); showOutputB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); showOutputB.setMaximumSize(new java.awt.Dimension(29, 29)); showOutputB.setMinimumSize(new java.awt.Dimension(29, 29)); showOutputB.setPreferredSize(new java.awt.Dimension(29, 29)); showOutputB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); showOutputB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showOutputBActionPerformed(evt); } }); topToolbar.add(showOutputB); topToolbar.add(jSeparator7); closeB.setFont(new java.awt.Font("Ebrima", 1, 22)); // NOI18N closeB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/closeb.png"))); // NOI18N closeB.setMnemonic('E'); closeB.setToolTipText("Close (Alt+E)"); closeB.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); closeB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); closeB.setFocusable(false); closeB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); closeB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); closeB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { closeBActionPerformed(evt); } }); topToolbar.add(closeB); getContentPane().add(topToolbar, java.awt.BorderLayout.NORTH); workArea.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); workArea.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { workAreaMouseClicked(evt); } }); getContentPane().add(workArea, java.awt.BorderLayout.CENTER); bottomContainer.setLayout(new java.awt.BorderLayout()); jToolBar2.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(204, 204, 255), null)); jToolBar2.setFloatable(false); jToolBar2.setRollover(true); jToolBar2.setPreferredSize(new java.awt.Dimension(227, 23)); jLabel2.setText(" What: "); jToolBar2.add(jLabel2); replaceWhatT.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N replaceWhatT.setMinimumSize(new java.awt.Dimension(6, 26)); replaceWhatT.setPreferredSize(new java.awt.Dimension(6, 10)); jToolBar2.add(replaceWhatT); jLabel1.setText(" Replace with: "); jToolBar2.add(jLabel1); replaceWithT.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N replaceWithT.setMinimumSize(new java.awt.Dimension(6, 26)); jToolBar2.add(replaceWithT); replaceB.setText("Replace"); replaceB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); replaceB.setFocusable(false); replaceB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); replaceB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); replaceB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceBActionPerformed(evt); } }); jToolBar2.add(replaceB); replaceAllB.setText("Replace All"); replaceAllB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); replaceAllB.setFocusable(false); replaceAllB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); replaceAllB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); replaceAllB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceAllBActionPerformed(evt); } }); jToolBar2.add(replaceAllB); bottomContainer.add(jToolBar2, java.awt.BorderLayout.NORTH); jToolBar2.setVisible(false); output.setFloatable(false); output.setRollover(true); output.setToolTipText("Output"); output.setMaximumSize(new java.awt.Dimension(32780, 100)); output.setName("Output"); // NOI18N output.setPreferredSize(new java.awt.Dimension(113, 100)); outputT.setColumns(20); outputT.setRows(5); jScrollPane2.setViewportView(outputT); jTabbedPane1.addTab("Output", jScrollPane2); output.add(jTabbedPane1); bottomContainer.add(output, java.awt.BorderLayout.CENTER); linecurL.setText("Total Line: 50; Current Line: 25; Character: 10;"); bottomContainer.add(linecurL, java.awt.BorderLayout.PAGE_END); getContentPane().add(bottomContainer, java.awt.BorderLayout.PAGE_END); pack(); }// </editor-fold> private void openBActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser jfc = new JFileChooser(); int response = jfc.showOpenDialog(this); if (response == JFileChooser.APPROVE_OPTION) { try { file = jfc.getSelectedFile();//future check FileInputStream fis = new FileInputStream(file); byte b[] = new byte[fis.available()]; fis.read(b); String str = new String(b); area = new Area(); area.setFont("Aerial", fontStyleC.getSelectedIndex(), Integer.parseInt(String.valueOf(fontSizeC.getSelectedItem()))); area.getArea().setText(str); String name = file.toString(); addTab(name, area); area.setEdited(false); area.setSaved(true); } catch (Exception e) { JOptionPane.showMessageDialog(this, "File Cannot Open"); } }} private void newBActionPerformed(java.awt.event.ActionEvent evt) { area = new Area(); area.setFont("Aerial", fontStyleC.getSelectedIndex(), Integer.parseInt(String.valueOf(fontSizeC.getSelectedItem()))); addTab("Untitled", area);} private void aboutBActionPerformed(java.awt.event.ActionEvent evt) { visible = !visible; aboutWin.setLocation(-aboutWin.getWidth() / 2 + this.getWidth() / 2, this.getY() - aboutWin.getHeight() / 2 + this.getHeight() / 2); aboutWin.setVisible(visible);} private void saveBActionPerformed(java.awt.event.ActionEvent evt) { save();} private void closeBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); if (area != null) { if (area.isEdited()) { int response = JOptionPane.showConfirmDialog(rootPane, "Do you want to Save Changes"); if (JOptionPane.YES_OPTION == response) { save(); workArea.removeTabAt(workArea.getSelectedIndex()); } else if (JOptionPane.NO_OPTION == response) { workArea.removeTabAt(workArea.getSelectedIndex()); } } else { workArea.removeTabAt(workArea.getSelectedIndex()); } } else { JOptionPane.showMessageDialog(rootPane, "There is no any opened document!"); }} private void cutBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); area.getArea().cut();} private void copyBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); area.getArea().copy();} private void pasteBActionPerformed(java.awt.event.ActionEvent evt) { area = (Area) workArea.getSelectedComponent(); area.getArea().paste();} private void findNBActionPerformed(java.awt.event.ActionEvent evt) { find(findT.getText(), pos, 1);} private void findPBActionPerformed(java.awt.event.ActionEvent evt) { find(findT.getText(), pos, -1);} private void workAreaMouseClicked(java.awt.event.MouseEvent evt) { area = (Area) workArea.getSelectedComponent(); String size = String.valueOf(area.getFont().getSize()); fontStyleC.setSelectedIndex(area.getFont().getStyle()); fontSizeC.setSelectedItem(size);} private void findTKeyReleased(java.awt.event.KeyEvent evt) { if (area.isHindi()) { area.getArea().getHighlighter().removeAllHighlights(); findAll(Translator.toHindi(findT.getText()), 0); } else { area.getArea().getHighlighter().removeAllHighlights(); findAll(findT.getText(), 0); }} private void readUrlBActionPerformed(java.awt.event.ActionEvent evt) { new Thread() { @Override public void run() { try { String path = JOptionPane.showInputDialog("Enter Url"); if (!path.startsWith("http://")) { path = "http://" + path; } new Thread() { @Override public void run() { int i = 0; pbar.setStringPainted(true); while (!taskDone) { if (i == 100) { i = 0; } pbar.setValue(i); i += 5; try { Thread.sleep(50); } catch (InterruptedException e) { } } pbar.setValue(100); pbar.setStringPainted(false); taskDone = false; } }.start(); URL url = new URL(path); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String read = null; String content = ""; while ((read = br.readLine()) != null) { content = content + read + "\n"; } br.close(); area = new Area(); area.getArea().setText(content); workArea.addTab(url.toString(), area); workArea.setSelectedIndex(workArea.getTabCount() - 1); taskDone = true; } catch (Exception ex) { taskDone = true; JOptionPane.showMessageDialog(null, ex); } } }.start();} private void showReplaceActionPerformed(java.awt.event.ActionEvent evt) { visible = !visible; jToolBar2.setVisible(visible); replaceWhatT.setText(findT.getText());} private void replaceBActionPerformed(java.awt.event.ActionEvent evt) { String string = area.getArea().getText(); string = string.replaceFirst(replaceWhatT.getText(), replaceWithT.getText()); area.getArea().setText(string);} private void replaceAllBActionPerformed(java.awt.event.ActionEvent evt) { String string = area.getArea().getText(); string = string.replaceAll(replaceWhatT.getText(), replaceWithT.getText()); area.getArea().setText(string);} private void fontSizeCActionPerformed(java.awt.event.ActionEvent evt) { try { int size = Integer.parseInt(String.valueOf(fontSizeC.getSelectedItem())); int style = fontStyleC.getSelectedIndex(); area.setFont("Aerial", style, size); } catch (Exception e) { fontSizeC.setSelectedIndex(2); }} private void fontStyleCActionPerformed(java.awt.event.ActionEvent evt) { int size = Integer.parseInt((String.valueOf(fontSizeC.getSelectedItem()))); int style = fontStyleC.getSelectedIndex(); area.setFont("Aerial", style, size); } private void compileBActionPerformed(java.awt.event.ActionEvent evt) { try { save(); if (area.isSaved()) { if(workArea.getTitleAt(workArea.getSelectedIndex()).lastIndexOf(".java")>0){ Runtime runtime = Runtime.getRuntime(); runtime.exec("javac " + workArea.getTitleAt(workArea.getSelectedIndex())); outputT.setText("Compiled Successfully"); }else{ outputT.setText("File Should be of .java extension"); } } else { outputT.setText("Cannot compile unsaved file"); } } catch (Exception ex) { outputT.setText("Error in Compilation! " + ex); } } private void runBActionPerformed(java.awt.event.ActionEvent evt) { save(); new Thread() { @Override public void run() { try { Runtime rt = Runtime.getRuntime(); String location = workArea.getTitleAt(workArea.getSelectedIndex()); String fl = location.substring(location.lastIndexOf("\\") + 1, location.lastIndexOf(".")); location = location.substring(0, location.lastIndexOf("\\")); Process pr = rt.exec("java -classpath \"" + location + "\" " + fl); BufferedReader br = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line; outputT.setText(""); while ((line = br.readLine()) != null) { outputT.setText(outputT.getText() + line + "\n"); } } catch (IOException ex) { outputT.setText(ex.toString()); } } }.start(); } private void langBActionPerformed(java.awt.event.ActionEvent evt) { if (area.isHindi()) { langB.setToolTipText("English"); area.setHindi(false); hmapB.setEnabled(false); langB.setIcon(new ImageIcon(getClass().getResource("/img/abc.png"))); } else { langB.setToolTipText("Hindi"); area.setHindi(true); hmapB.setEnabled(true); langB.setIcon(new ImageIcon(getClass().getResource("/img/a.png"))); } } private void hmapBActionPerformed(java.awt.event.ActionEvent evt) { if (hMap == null) { hMap = new HindiMap(); } if (hMap.isVisible()) { hMap.setVisible(false); } else { hMap.setVisible(true); } } private void showOutputBActionPerformed(java.awt.event.ActionEvent evt) { if (output.isVisible()) { output.setVisible(false); } else { output.setVisible(true); } } public void find(String search, int pos, int d) { area.getArea().getHighlighter().removeAllHighlights(); if (d == 1) { pos = area.getArea().getText().replaceAll("\n", "").indexOf(search, pos); }//replaceAll to remove new lines character if (d == -1) { pos = area.getArea().getText().replaceAll("\n", "").lastIndexOf(search, pos); } if (pos >= 0) { try { Highlighter h = area.getArea().getHighlighter(); h.addHighlight(pos, pos + search.length(), new DefaultHighlighter.DefaultHighlightPainter(Color.GREEN)); } catch (Exception ex) { JOptionPane.showMessageDialog(area.getArea(), ex); } if (d == -1) { this.pos = pos - search.length(); } if (d == 1) { this.pos = pos + search.length(); } } } public void findAll(String search, int pos) { pos = area.getArea().getText().replaceAll("\n", "").indexOf(search, pos);//replaceAll to remove new lines character if (pos >= 0 && search.length() > 0) { try { Highlighter h = area.getArea().getHighlighter(); h.addHighlight(pos, pos + search.length(), new DefaultHighlighter.DefaultHighlightPainter(Color.GREEN)); } catch (Exception ex) { JOptionPane.showMessageDialog(area.getArea(), ex); } pos += search.length(); if (pos < area.getArea().getText().length()) { findAll(search, pos); }//recursion } } public void save() { JFileChooser jfc = new JFileChooser(); area = (Area) workArea.getSelectedComponent(); if (!area.isSaved()) { int response = jfc.showSaveDialog(this); if (response == JFileChooser.APPROVE_OPTION) { file = jfc.getSelectedFile(); if (file.exists()) { response = JOptionPane.showConfirmDialog(this, "File allready exists, Dou you want to overrite"); if (response == JOptionPane.YES_OPTION) { write(area); } else if (response == JOptionPane.NO_OPTION) { save(); } } else if (!file.exists()) { write(area); } area.setSaved(true); } } else { write(area); } } private void write(Area area) { try { String str = area.getArea().getText(); pw = new PrintWriter(new FileOutputStream(file)); pw.write(str); pw.flush(); String name = file.toString(); //name = name.substring(name.lastIndexOf("\\") + 1, name.length()); workArea.setTitleAt(workArea.getSelectedIndex(), name); area.setEdited(false); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Cannot Save"); } } private void addTab(String title, Area area) { workArea.addTab(title, area); workArea.setSelectedIndex(workArea.getTabCount() - 1); } boolean taskDone = false; boolean running = true; private HindiMap hMap; private PrintWriter pw; private File file; private Area area; private int pos; private boolean visible; private About aboutWin = new About(); boolean closeAll = false; // Variables declaration - do not modify private javax.swing.JButton aboutB; private javax.swing.JPanel bottomContainer; private javax.swing.JButton closeB; private javax.swing.JButton compileB; private javax.swing.JButton copyB; private javax.swing.JButton cutB; private javax.swing.Box.Filler filler1; private javax.swing.Box.Filler filler2; private javax.swing.JButton findNB; private javax.swing.JButton findPB; private javax.swing.JTextField findT; private javax.swing.JComboBox fontSizeC; private javax.swing.JComboBox fontStyleC; private javax.swing.JButton hmapB; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JToolBar.Separator jSeparator1; private javax.swing.JToolBar.Separator jSeparator10; private javax.swing.JToolBar.Separator jSeparator2; private javax.swing.JToolBar.Separator jSeparator3; private javax.swing.JToolBar.Separator jSeparator4; private javax.swing.JToolBar.Separator jSeparator5; private javax.swing.JToolBar.Separator jSeparator6; private javax.swing.JToolBar.Separator jSeparator7; private javax.swing.JToolBar.Separator jSeparator8; private javax.swing.JToolBar.Separator jSeparator9; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JToolBar jToolBar2; private javax.swing.JButton langB; private javax.swing.JLabel linecurL; private javax.swing.JButton newB; private javax.swing.JButton openB; private javax.swing.JToolBar output; private javax.swing.JTextArea outputT; private javax.swing.JButton pasteB; private javax.swing.JProgressBar pbar; private javax.swing.JButton readUrlB; private javax.swing.JButton replaceAllB; private javax.swing.JButton replaceB; private javax.swing.JTextField replaceWhatT; private javax.swing.JTextField replaceWithT; private javax.swing.JButton runB; private javax.swing.JButton saveB; private javax.swing.JButton showOutputB; private javax.swing.JButton showReplace; private javax.swing.JToolBar topToolbar; private javax.swing.JTabbedPane workArea; // End of variables declaration @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { closeAll = true; running = false; } @Override public void windowClosed(WindowEvent e) { System.exit(0); } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { }} HindiMap.java HindiMap.java Java package jeditor; import javax.swing.table.TableModel; /** * * @author Rajesh Kumar Sahanee */ public class HindiMap extends javax.swing.JFrame { /** * Creates new form HindiMap */ public HindiMap() { initComponents(); initializeMap(); } private void initializeMap(){ TableModel tm = mapTable.getModel(); tm.setValueAt(Translator.toHindi("a"), 0, 0); tm.setValueAt("a/A", 0, 1); tm.setValueAt(Translator.toHindi("aa"), 0, 2); tm.setValueAt("aa", 0, 3); tm.setValueAt(Translator.toHindi("i"), 0, 4); tm.setValueAt("i", 0, 5); tm.setValueAt(Translator.toHindi("ee"), 0, 6); tm.setValueAt("ee/I", 0, 7); tm.setValueAt(Translator.toHindi("u"), 0, 8); tm.setValueAt("u", 0, 9); tm.setValueAt(Translator.toHindi("uu"), 1, 0); tm.setValueAt("uu/oo/U", 1, 1); tm.setValueAt(Translator.toHindi("RRi"), 1, 2); tm.setValueAt("RRi", 1, 3); tm.setValueAt(Translator.toHindi("e"), 1, 4); tm.setValueAt("e", 1, 5); tm.setValueAt(Translator.toHindi("ai"), 1, 6); tm.setValueAt("ai", 1, 7); tm.setValueAt(Translator.toHindi("o"), 1, 8); tm.setValueAt("o", 1, 9); tm.setValueAt(Translator.toHindi("au"), 2, 0); tm.setValueAt("au/ou", 2, 1); tm.setValueAt(Translator.toHindi("aM"), 2, 2); tm.setValueAt("aM", 2, 3); tm.setValueAt(Translator.toHindi("aH"), 2, 4); tm.setValueAt("aH", 2, 5); tm.setValueAt(Translator.toHindi(".n"), 3, 0); tm.setValueAt(".n", 3, 1); tm.setValueAt(Translator.toHindi(".N"), 3, 2); tm.setValueAt(".N", 3, 3); tm.setValueAt(Translator.toHindi(".h"), 3, 4); tm.setValueAt(".h", 3, 5); tm.setValueAt(Translator.toHindi("k")+"/"+Translator.toHindi("ka"), 4, 0); tm.setValueAt("k/ka", 4, 1); tm.setValueAt(Translator.toHindi("kh")+"/"+Translator.toHindi("kha"), 4, 2); tm.setValueAt("kh/kha", 4, 3); tm.setValueAt(Translator.toHindi("g")+"/"+Translator.toHindi("ga"), 4, 4); tm.setValueAt("g/ga", 4, 5); tm.setValueAt(Translator.toHindi("gh")+"/"+Translator.toHindi("gha"), 4, 6); tm.setValueAt("gh/gha", 4, 7); tm.setValueAt(Translator.toHindi("~N"), 4, 8); tm.setValueAt("~N", 4, 9); tm.setValueAt(Translator.toHindi("ch")+"/"+Translator.toHindi("cha"), 5, 0); tm.setValueAt("ch/cha", 5, 1); tm.setValueAt(Translator.toHindi("chh")+"/"+Translator.toHindi("chha"), 5, 2); tm.setValueAt("chh/chha", 5, 3); tm.setValueAt(Translator.toHindi("j")+"/"+Translator.toHindi("ja"), 5, 4); tm.setValueAt("j/ja", 5, 5); tm.setValueAt(Translator.toHindi("jh")+"/"+Translator.toHindi("jha"), 5, 6); tm.setValueAt("jh/jha", 5, 7); tm.setValueAt(Translator.toHindi("~n"), 5, 8); tm.setValueAt("~n", 5, 9); tm.setValueAt(Translator.toHindi("T")+"/"+Translator.toHindi("Ta"), 6, 0); tm.setValueAt("T/Ta", 6, 1); tm.setValueAt(Translator.toHindi("Th")+"/"+Translator.toHindi("Tha"), 6, 2); tm.setValueAt("Th/Tha", 6, 3); tm.setValueAt(Translator.toHindi("D")+"/"+Translator.toHindi("Da"), 6, 4); tm.setValueAt("D/Da", 6, 5); tm.setValueAt(Translator.toHindi("Dh")+"/"+Translator.toHindi("Dha"), 6, 6); tm.setValueAt("Dh/Dha", 6, 7); tm.setValueAt(Translator.toHindi("N")+"/"+Translator.toHindi("Na"), 6, 8); tm.setValueAt("N/Na", 6, 9); tm.setValueAt(Translator.toHindi("t")+"/"+Translator.toHindi("ta"), 7, 0); tm.setValueAt("t/ta", 7, 1); tm.setValueAt(Translator.toHindi("th")+"/"+Translator.toHindi("tha"), 7, 2); tm.setValueAt("th/tha", 7, 3); tm.setValueAt(Translator.toHindi("d")+"/"+Translator.toHindi("da"), 7, 4); tm.setValueAt("d/da", 7, 5); tm.setValueAt(Translator.toHindi("dh")+"/"+Translator.toHindi("dha"), 7, 6); tm.setValueAt("dh/dha", 7, 7); tm.setValueAt(Translator.toHindi("n")+"/"+Translator.toHindi("na"), 7, 8); tm.setValueAt("n/na", 7, 9); tm.setValueAt(Translator.toHindi("p")+"/"+Translator.toHindi("pa"), 8, 0); tm.setValueAt("p/pa", 8, 1); tm.setValueAt(Translator.toHindi("ph")+"/"+Translator.toHindi("pha"), 8, 2); tm.setValueAt("ph/pha", 8, 3); tm.setValueAt(Translator.toHindi("b")+"/"+Translator.toHindi("ba"), 8, 4); tm.setValueAt("b/ba", 8, 5); tm.setValueAt(Translator.toHindi("bh")+"/"+Translator.toHindi("bha"), 8, 6); tm.setValueAt("bh/bha", 8, 7); tm.setValueAt(Translator.toHindi("m"), 8, 8); tm.setValueAt("m", 8, 9); tm.setValueAt(Translator.toHindi("y")+"/"+Translator.toHindi("ya"), 9, 0); tm.setValueAt("y/ya", 9, 1); tm.setValueAt(Translator.toHindi("r")+"/"+Translator.toHindi("ra"), 9, 2); tm.setValueAt("r/ra", 9, 3); tm.setValueAt(Translator.toHindi("l")+"/"+Translator.toHindi("la"), 9, 4); tm.setValueAt("l/la", 9, 5); tm.setValueAt(Translator.toHindi("v")+"/"+Translator.toHindi("va"), 9, 6); tm.setValueAt("(v/w)/(va/wa)", 9, 7); tm.setValueAt(Translator.toHindi("sh")+"/"+Translator.toHindi("sha"), 10, 0); tm.setValueAt("sh/sha", 10, 1); tm.setValueAt(Translator.toHindi("shh")+"/"+Translator.toHindi("shha"), 10, 2); tm.setValueAt("shh/shha", 10, 3); tm.setValueAt(Translator.toHindi("s")+"/"+Translator.toHindi("sa"), 10, 4); tm.setValueAt("s/sa", 10, 5); tm.setValueAt(Translator.toHindi("h")+"/"+Translator.toHindi("ha"), 10, 6); tm.setValueAt("h/ha", 10, 7); tm.setValueAt(Translator.toHindi("L"), 10, 8); tm.setValueAt("L", 10, 9); tm.setValueAt(Translator.toHindi("kSh"), 11, 0); tm.setValueAt("kSh", 11, 1); tm.setValueAt(Translator.toHindi("tr")+"/"+Translator.toHindi("tra"), 11, 2); tm.setValueAt("tr/tra", 11, 3); tm.setValueAt(Translator.toHindi("GY")+"/"+Translator.toHindi("GYa"), 11, 4); tm.setValueAt("GY/GYa", 11, 5); tm.setValueAt(Translator.toHindi("shr")+"/"+Translator.toHindi("shra"), 11, 6); tm.setValueAt("shr/shra", 11, 7); mapTable.setModel(tm); mapTable.updateUI(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { mainContainer = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); mapTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Hindi Map"); setResizable(false); mapTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {"", null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null} }, new String [] { "HIN", "ENG", "HIN", "ENG", "HIN", "ENG", "HIN", "ENG", "HIN", "ENG" } )); mapTable.setSelectionBackground(new java.awt.Color(204, 204, 204)); mapTable.setShowHorizontalLines(false); mapTable.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(mapTable); javax.swing.GroupLayout mainContainerLayout = new javax.swing.GroupLayout(mainContainer); mainContainer.setLayout(mainContainerLayout); mainContainerLayout.setHorizontalGroup( mainContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(mainContainerLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 603, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); mainContainerLayout.setVerticalGroup( mainContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(mainContainerLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); getContentPane().add(mainContainer, java.awt.BorderLayout.LINE_END); pack(); }// </editor-fold> // Variables declaration - do not modify private javax.swing.JScrollPane jScrollPane1; private javax.swing.JPanel mainContainer; private javax.swing.JTable mapTable; // End of variables declaration } 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 package jeditor; import javax.swing.table.TableModel; /** * * @author Rajesh Kumar Sahanee */public class HindiMap extends javax.swing.JFrame { /** * Creates new form HindiMap */ public HindiMap() { initComponents(); initializeMap(); } private void initializeMap(){ TableModel tm = mapTable.getModel(); tm.setValueAt(Translator.toHindi("a"), 0, 0); tm.setValueAt("a/A", 0, 1); tm.setValueAt(Translator.toHindi("aa"), 0, 2); tm.setValueAt("aa", 0, 3); tm.setValueAt(Translator.toHindi("i"), 0, 4); tm.setValueAt("i", 0, 5); tm.setValueAt(Translator.toHindi("ee"), 0, 6); tm.setValueAt("ee/I", 0, 7); tm.setValueAt(Translator.toHindi("u"), 0, 8); tm.setValueAt("u", 0, 9); tm.setValueAt(Translator.toHindi("uu"), 1, 0); tm.setValueAt("uu/oo/U", 1, 1); tm.setValueAt(Translator.toHindi("RRi"), 1, 2); tm.setValueAt("RRi", 1, 3); tm.setValueAt(Translator.toHindi("e"), 1, 4); tm.setValueAt("e", 1, 5); tm.setValueAt(Translator.toHindi("ai"), 1, 6); tm.setValueAt("ai", 1, 7); tm.setValueAt(Translator.toHindi("o"), 1, 8); tm.setValueAt("o", 1, 9); tm.setValueAt(Translator.toHindi("au"), 2, 0); tm.setValueAt("au/ou", 2, 1); tm.setValueAt(Translator.toHindi("aM"), 2, 2); tm.setValueAt("aM", 2, 3); tm.setValueAt(Translator.toHindi("aH"), 2, 4); tm.setValueAt("aH", 2, 5); tm.setValueAt(Translator.toHindi(".n"), 3, 0); tm.setValueAt(".n", 3, 1); tm.setValueAt(Translator.toHindi(".N"), 3, 2); tm.setValueAt(".N", 3, 3); tm.setValueAt(Translator.toHindi(".h"), 3, 4); tm.setValueAt(".h", 3, 5); tm.setValueAt(Translator.toHindi("k")+"/"+Translator.toHindi("ka"), 4, 0); tm.setValueAt("k/ka", 4, 1); tm.setValueAt(Translator.toHindi("kh")+"/"+Translator.toHindi("kha"), 4, 2); tm.setValueAt("kh/kha", 4, 3); tm.setValueAt(Translator.toHindi("g")+"/"+Translator.toHindi("ga"), 4, 4); tm.setValueAt("g/ga", 4, 5); tm.setValueAt(Translator.toHindi("gh")+"/"+Translator.toHindi("gha"), 4, 6); tm.setValueAt("gh/gha", 4, 7); tm.setValueAt(Translator.toHindi("~N"), 4, 8); tm.setValueAt("~N", 4, 9); tm.setValueAt(Translator.toHindi("ch")+"/"+Translator.toHindi("cha"), 5, 0); tm.setValueAt("ch/cha", 5, 1); tm.setValueAt(Translator.toHindi("chh")+"/"+Translator.toHindi("chha"), 5, 2); tm.setValueAt("chh/chha", 5, 3); tm.setValueAt(Translator.toHindi("j")+"/"+Translator.toHindi("ja"), 5, 4); tm.setValueAt("j/ja", 5, 5); tm.setValueAt(Translator.toHindi("jh")+"/"+Translator.toHindi("jha"), 5, 6); tm.setValueAt("jh/jha", 5, 7); tm.setValueAt(Translator.toHindi("~n"), 5, 8); tm.setValueAt("~n", 5, 9); tm.setValueAt(Translator.toHindi("T")+"/"+Translator.toHindi("Ta"), 6, 0); tm.setValueAt("T/Ta", 6, 1); tm.setValueAt(Translator.toHindi("Th")+"/"+Translator.toHindi("Tha"), 6, 2); tm.setValueAt("Th/Tha", 6, 3); tm.setValueAt(Translator.toHindi("D")+"/"+Translator.toHindi("Da"), 6, 4); tm.setValueAt("D/Da", 6, 5); tm.setValueAt(Translator.toHindi("Dh")+"/"+Translator.toHindi("Dha"), 6, 6); tm.setValueAt("Dh/Dha", 6, 7); tm.setValueAt(Translator.toHindi("N")+"/"+Translator.toHindi("Na"), 6, 8); tm.setValueAt("N/Na", 6, 9); tm.setValueAt(Translator.toHindi("t")+"/"+Translator.toHindi("ta"), 7, 0); tm.setValueAt("t/ta", 7, 1); tm.setValueAt(Translator.toHindi("th")+"/"+Translator.toHindi("tha"), 7, 2); tm.setValueAt("th/tha", 7, 3); tm.setValueAt(Translator.toHindi("d")+"/"+Translator.toHindi("da"), 7, 4); tm.setValueAt("d/da", 7, 5); tm.setValueAt(Translator.toHindi("dh")+"/"+Translator.toHindi("dha"), 7, 6); tm.setValueAt("dh/dha", 7, 7); tm.setValueAt(Translator.toHindi("n")+"/"+Translator.toHindi("na"), 7, 8); tm.setValueAt("n/na", 7, 9); tm.setValueAt(Translator.toHindi("p")+"/"+Translator.toHindi("pa"), 8, 0); tm.setValueAt("p/pa", 8, 1); tm.setValueAt(Translator.toHindi("ph")+"/"+Translator.toHindi("pha"), 8, 2); tm.setValueAt("ph/pha", 8, 3); tm.setValueAt(Translator.toHindi("b")+"/"+Translator.toHindi("ba"), 8, 4); tm.setValueAt("b/ba", 8, 5); tm.setValueAt(Translator.toHindi("bh")+"/"+Translator.toHindi("bha"), 8, 6); tm.setValueAt("bh/bha", 8, 7); tm.setValueAt(Translator.toHindi("m"), 8, 8); tm.setValueAt("m", 8, 9); tm.setValueAt(Translator.toHindi("y")+"/"+Translator.toHindi("ya"), 9, 0); tm.setValueAt("y/ya", 9, 1); tm.setValueAt(Translator.toHindi("r")+"/"+Translator.toHindi("ra"), 9, 2); tm.setValueAt("r/ra", 9, 3); tm.setValueAt(Translator.toHindi("l")+"/"+Translator.toHindi("la"), 9, 4); tm.setValueAt("l/la", 9, 5); tm.setValueAt(Translator.toHindi("v")+"/"+Translator.toHindi("va"), 9, 6); tm.setValueAt("(v/w)/(va/wa)", 9, 7); tm.setValueAt(Translator.toHindi("sh")+"/"+Translator.toHindi("sha"), 10, 0); tm.setValueAt("sh/sha", 10, 1); tm.setValueAt(Translator.toHindi("shh")+"/"+Translator.toHindi("shha"), 10, 2); tm.setValueAt("shh/shha", 10, 3); tm.setValueAt(Translator.toHindi("s")+"/"+Translator.toHindi("sa"), 10, 4); tm.setValueAt("s/sa", 10, 5); tm.setValueAt(Translator.toHindi("h")+"/"+Translator.toHindi("ha"), 10, 6); tm.setValueAt("h/ha", 10, 7); tm.setValueAt(Translator.toHindi("L"), 10, 8); tm.setValueAt("L", 10, 9); tm.setValueAt(Translator.toHindi("kSh"), 11, 0); tm.setValueAt("kSh", 11, 1); tm.setValueAt(Translator.toHindi("tr")+"/"+Translator.toHindi("tra"), 11, 2); tm.setValueAt("tr/tra", 11, 3); tm.setValueAt(Translator.toHindi("GY")+"/"+Translator.toHindi("GYa"), 11, 4); tm.setValueAt("GY/GYa", 11, 5); tm.setValueAt(Translator.toHindi("shr")+"/"+Translator.toHindi("shra"), 11, 6); tm.setValueAt("shr/shra", 11, 7); mapTable.setModel(tm); mapTable.updateUI(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { mainContainer = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); mapTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Hindi Map"); setResizable(false); mapTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {"", null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null} }, new String [] { "HIN", "ENG", "HIN", "ENG", "HIN", "ENG", "HIN", "ENG", "HIN", "ENG" } )); mapTable.setSelectionBackground(new java.awt.Color(204, 204, 204)); mapTable.setShowHorizontalLines(false); mapTable.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(mapTable); javax.swing.GroupLayout mainContainerLayout = new javax.swing.GroupLayout(mainContainer); mainContainer.setLayout(mainContainerLayout); mainContainerLayout.setHorizontalGroup( mainContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(mainContainerLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 603, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); mainContainerLayout.setVerticalGroup( mainContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(mainContainerLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); getContentPane().add(mainContainer, java.awt.BorderLayout.LINE_END); pack(); }// </editor-fold> // Variables declaration - do not modify private javax.swing.JScrollPane jScrollPane1; private javax.swing.JPanel mainContainer; private javax.swing.JTable mapTable; // End of variables declaration } Translator.java Translator.java Java package jeditor; import java.io.UnsupportedEncodingException; /** * * @author Rajesh Kumar Sahanee */ public class Translator { public static String toEnglish(String hindi) { String english = hindi; if (english != null) { english = english.replaceAll("\u0915\u094D\u0937","kSh"); english = english.replaceAll("\u091C\u094D\u091E\u093E","GYa"); english = english.replaceAll("\u091C\u094D\u091E","GY"); english = english.replaceAll("\u0902",".n"); english = english.replaceAll("\u0901",".N"); english = english.replaceAll("\u0903",".h"); english = english.replaceAll("\u0916", "kh"); english = english.replaceAll("\u0915", "k"); english = english.replaceAll("\u0918", "gh"); english = english.replaceAll("\u0917", "g"); english = english.replaceAll("\u0919", "~N"); english = english.replaceAll("\u091B", "chh"); english = english.replaceAll("\u091A", "ch"); english = english.replaceAll("\u091D", "jh"); english = english.replaceAll("\u091C", "j"); english = english.replaceAll("\u091E", "~n"); english = english.replaceAll("\u0920", "Th"); english = english.replaceAll("\u091F", "T"); english = english.replaceAll("\u0922", "Dh"); english = english.replaceAll("\u0921", "D"); english = english.replaceAll("\u0923", "N"); english = english.replaceAll("\u0925", "th"); english = english.replaceAll("\u0924", "t"); english = english.replaceAll("\u0927", "dh"); english = english.replaceAll("\u0926", "d"); english = english.replaceAll("\u0928", "n"); english = english.replaceAll("\u092B", "ph"); english = english.replaceAll("\u092A", "p"); english = english.replaceAll("\u092D", "bh"); english = english.replaceAll("\u092C", "b"); english = english.replaceAll("\u092E", "m"); english = english.replaceAll("\u092F", "y"); english = english.replaceAll("\u0930", "r"); english = english.replaceAll("\u0932", "l"); english = english.replaceAll("\u0923", "L"); english = english.replaceAll("\u0935", "v"); english = english.replaceAll("\u0935", "w"); english = english.replaceAll("\u0937", "shh"); english = english.replaceAll("\u0936", "sh"); english = english.replaceAll("\u0938", "s"); english = english.replaceAll("\u0939", "h"); english = english.replaceAll("\u094D", "`"); english = english.replaceAll("\u0906", "AA"); english = english.replaceAll("\u0948", "ai"); english = english.replaceAll("\u0910", "AI"); english = english.replaceAll("\u093F", "i"); english = english.replaceAll("\u0907", "I"); english = english.replaceAll("\u0940", "ee"); english = english.replaceAll("\u0908", "EE"); english = english.replaceAll("\u0941", "u"); english = english.replaceAll("\u0909", "U"); english = english.replaceAll("\u0942", "oo"); english = english.replaceAll("\u090A", "OO"); english = english.replaceAll("\u090B", "RRi"); english = english.replaceAll("\u090C", "LLi"); english = english.replaceAll("\u0947", "e"); english = english.replaceAll("\u090F", "E"); english = english.replaceAll("\u094B", "o"); english = english.replaceAll("\u0913", "O"); english = english.replaceAll("\u094C", "au"); english = english.replaceAll("\u0914", "AU"); english = english.replaceAll("\u0905\u0902", "aM"); english = english.replaceAll("\u0905\u0903", "aH"); english = english.replaceAll("\u093E", "a"); english = english.replaceAll("\u0905", "A"); } return english; } public static String toHindi(String english) { String hindi = toEnglish(english); if (hindi != null) { hindi = hindi.replaceAll("kSha","\u0915\u094D\u0937\u093E"); hindi = hindi.replaceAll("kSh","\u0915\u094D\u0937"); hindi = hindi.replaceAll("GYa","\u091C\u094D\u091E\u093E"); hindi = hindi.replaceAll("GY","\u091C\u094D\u091E"); hindi = hindi.replaceAll("kh", "\u0916"); hindi = hindi.replaceAll("k", "\u0915"); hindi = hindi.replaceAll("gh", "\u0918\u094D"); hindi = hindi.replaceAll("g", "\u0917"); hindi = hindi.replaceAll("~N", "\u0919"); hindi = hindi.replaceAll("chh", "\u091B"); hindi = hindi.replaceAll("ch", "\u091A"); hindi = hindi.replaceAll("jh", "\u091D"); hindi = hindi.replaceAll("j", "\u091C"); hindi = hindi.replaceAll("~n", "\u091E"); hindi = hindi.replaceAll("Th", "\u0920"); hindi = hindi.replaceAll("T", "\u091F"); hindi = hindi.replaceAll("Dh", "\u0922"); hindi = hindi.replaceAll("D", "\u0921"); hindi = hindi.replaceAll("th", "\u0925"); hindi = hindi.replaceAll("t", "\u0924"); hindi = hindi.replaceAll("dh", "\u0927"); hindi = hindi.replaceAll("d", "\u0926"); //hindi = hindi.replaceAll("n", "\u0928"); hindi = hindi.replaceAll("ph", "\u092B"); hindi = hindi.replaceAll("f", "\u092B"); hindi = hindi.replaceAll("p", "\u092A"); hindi = hindi.replaceAll("bh", "\u092D"); hindi = hindi.replaceAll("b", "\u092C"); hindi = hindi.replaceAll("m", "\u092E"); hindi = hindi.replaceAll("y", "\u092F"); hindi = hindi.replaceAll("r", "\u0930"); //hindi = hindi.replaceAll("RRA", "\u0931"); hindi = hindi.replaceAll("l", "\u0932"); hindi = hindi.replaceAll("L", "\u0933"); //hindi = hindi.replaceAll("LLLA", "\u0934"); hindi = hindi.replaceAll("v", "\u0935"); hindi = hindi.replaceAll("w", "\u0935"); hindi = hindi.replaceAll("shh", "\u0937"); hindi = hindi.replaceAll("sh", "\u0936"); hindi = hindi.replaceAll("s", "\u0938"); hindi = hindi.replaceAll("\\.n", "\u0902"); hindi = hindi.replaceAll("\\.N", "\u0901"); hindi = hindi.replaceAll("\\.h", "\u0903"); hindi = hindi.replaceAll("n", "\u0928"); hindi = hindi.replaceAll("N", "\u0923"); hindi = hindi.replaceAll("h", "\u0939"); hindi = hindi.replaceAll("`", "\u094D"); hindi = hindi.replaceAll("AA", "\u0906"); hindi = hindi.replaceAll("ai", "\u0948"); hindi = hindi.replaceAll("AI", "\u0910"); hindi = hindi.replaceAll("ee", "\u0940"); hindi = hindi.replaceAll("EE", "\u0908"); hindi = hindi.replaceAll("oo", "\u0942"); hindi = hindi.replaceAll("OO", "\u090A"); hindi = hindi.replaceAll("RRi", "\u090B"); hindi = hindi.replaceAll("Ri", "\u0943"); hindi = hindi.replaceAll("LLi", "\u090C"); hindi = hindi.replaceAll("i", "\u093F"); hindi = hindi.replaceAll("I", "\u0907"); hindi = hindi.replaceAll("e", "\u0947"); hindi = hindi.replaceAll("E", "\u090F"); hindi = hindi.replaceAll("au", "\u094C"); hindi = hindi.replaceAll("AU", "\u0914"); hindi = hindi.replaceAll("ou", "\u094C"); hindi = hindi.replaceAll("OU", "\u0914"); hindi = hindi.replaceAll("u", "\u0941"); hindi = hindi.replaceAll("U", "\u0909"); hindi = hindi.replaceAll("o", "\u094B"); hindi = hindi.replaceAll("O", "\u0913"); hindi = hindi.replaceAll("aM", "\u0905\u0902"); hindi = hindi.replaceAll("aH", "\u0905\u0903"); hindi = hindi.replaceAll("a", "\u093E"); hindi = hindi.replaceAll("A", "\u0905"); } try { return new String(hindi.getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { return null; } catch (NullPointerException ex) { return null; } } } 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 package jeditor; import java.io.UnsupportedEncodingException; /** * * @author Rajesh Kumar Sahanee */public class Translator { public static String toEnglish(String hindi) { String english = hindi; if (english != null) { english = english.replaceAll("\u0915\u094D\u0937","kSh"); english = english.replaceAll("\u091C\u094D\u091E\u093E","GYa"); english = english.replaceAll("\u091C\u094D\u091E","GY"); english = english.replaceAll("\u0902",".n"); english = english.replaceAll("\u0901",".N"); english = english.replaceAll("\u0903",".h"); english = english.replaceAll("\u0916", "kh"); english = english.replaceAll("\u0915", "k"); english = english.replaceAll("\u0918", "gh"); english = english.replaceAll("\u0917", "g"); english = english.replaceAll("\u0919", "~N"); english = english.replaceAll("\u091B", "chh"); english = english.replaceAll("\u091A", "ch"); english = english.replaceAll("\u091D", "jh"); english = english.replaceAll("\u091C", "j"); english = english.replaceAll("\u091E", "~n"); english = english.replaceAll("\u0920", "Th"); english = english.replaceAll("\u091F", "T"); english = english.replaceAll("\u0922", "Dh"); english = english.replaceAll("\u0921", "D"); english = english.replaceAll("\u0923", "N"); english = english.replaceAll("\u0925", "th"); english = english.replaceAll("\u0924", "t"); english = english.replaceAll("\u0927", "dh"); english = english.replaceAll("\u0926", "d"); english = english.replaceAll("\u0928", "n"); english = english.replaceAll("\u092B", "ph"); english = english.replaceAll("\u092A", "p"); english = english.replaceAll("\u092D", "bh"); english = english.replaceAll("\u092C", "b"); english = english.replaceAll("\u092E", "m"); english = english.replaceAll("\u092F", "y"); english = english.replaceAll("\u0930", "r"); english = english.replaceAll("\u0932", "l"); english = english.replaceAll("\u0923", "L"); english = english.replaceAll("\u0935", "v"); english = english.replaceAll("\u0935", "w"); english = english.replaceAll("\u0937", "shh"); english = english.replaceAll("\u0936", "sh"); english = english.replaceAll("\u0938", "s"); english = english.replaceAll("\u0939", "h"); english = english.replaceAll("\u094D", "`"); english = english.replaceAll("\u0906", "AA"); english = english.replaceAll("\u0948", "ai"); english = english.replaceAll("\u0910", "AI"); english = english.replaceAll("\u093F", "i"); english = english.replaceAll("\u0907", "I"); english = english.replaceAll("\u0940", "ee"); english = english.replaceAll("\u0908", "EE"); english = english.replaceAll("\u0941", "u"); english = english.replaceAll("\u0909", "U"); english = english.replaceAll("\u0942", "oo"); english = english.replaceAll("\u090A", "OO"); english = english.replaceAll("\u090B", "RRi"); english = english.replaceAll("\u090C", "LLi"); english = english.replaceAll("\u0947", "e"); english = english.replaceAll("\u090F", "E"); english = english.replaceAll("\u094B", "o"); english = english.replaceAll("\u0913", "O"); english = english.replaceAll("\u094C", "au"); english = english.replaceAll("\u0914", "AU"); english = english.replaceAll("\u0905\u0902", "aM"); english = english.replaceAll("\u0905\u0903", "aH"); english = english.replaceAll("\u093E", "a"); english = english.replaceAll("\u0905", "A"); } return english; } public static String toHindi(String english) { String hindi = toEnglish(english); if (hindi != null) { hindi = hindi.replaceAll("kSha","\u0915\u094D\u0937\u093E"); hindi = hindi.replaceAll("kSh","\u0915\u094D\u0937"); hindi = hindi.replaceAll("GYa","\u091C\u094D\u091E\u093E"); hindi = hindi.replaceAll("GY","\u091C\u094D\u091E"); hindi = hindi.replaceAll("kh", "\u0916"); hindi = hindi.replaceAll("k", "\u0915"); hindi = hindi.replaceAll("gh", "\u0918\u094D"); hindi = hindi.replaceAll("g", "\u0917"); hindi = hindi.replaceAll("~N", "\u0919"); hindi = hindi.replaceAll("chh", "\u091B"); hindi = hindi.replaceAll("ch", "\u091A"); hindi = hindi.replaceAll("jh", "\u091D"); hindi = hindi.replaceAll("j", "\u091C"); hindi = hindi.replaceAll("~n", "\u091E"); hindi = hindi.replaceAll("Th", "\u0920"); hindi = hindi.replaceAll("T", "\u091F"); hindi = hindi.replaceAll("Dh", "\u0922"); hindi = hindi.replaceAll("D", "\u0921"); hindi = hindi.replaceAll("th", "\u0925"); hindi = hindi.replaceAll("t", "\u0924"); hindi = hindi.replaceAll("dh", "\u0927"); hindi = hindi.replaceAll("d", "\u0926"); //hindi = hindi.replaceAll("n", "\u0928"); hindi = hindi.replaceAll("ph", "\u092B"); hindi = hindi.replaceAll("f", "\u092B"); hindi = hindi.replaceAll("p", "\u092A"); hindi = hindi.replaceAll("bh", "\u092D"); hindi = hindi.replaceAll("b", "\u092C"); hindi = hindi.replaceAll("m", "\u092E"); hindi = hindi.replaceAll("y", "\u092F"); hindi = hindi.replaceAll("r", "\u0930"); //hindi = hindi.replaceAll("RRA", "\u0931"); hindi = hindi.replaceAll("l", "\u0932"); hindi = hindi.replaceAll("L", "\u0933"); //hindi = hindi.replaceAll("LLLA", "\u0934"); hindi = hindi.replaceAll("v", "\u0935"); hindi = hindi.replaceAll("w", "\u0935"); hindi = hindi.replaceAll("shh", "\u0937"); hindi = hindi.replaceAll("sh", "\u0936"); hindi = hindi.replaceAll("s", "\u0938"); hindi = hindi.replaceAll("\\.n", "\u0902"); hindi = hindi.replaceAll("\\.N", "\u0901"); hindi = hindi.replaceAll("\\.h", "\u0903"); hindi = hindi.replaceAll("n", "\u0928"); hindi = hindi.replaceAll("N", "\u0923"); hindi = hindi.replaceAll("h", "\u0939"); hindi = hindi.replaceAll("`", "\u094D"); hindi = hindi.replaceAll("AA", "\u0906"); hindi = hindi.replaceAll("ai", "\u0948"); hindi = hindi.replaceAll("AI", "\u0910"); hindi = hindi.replaceAll("ee", "\u0940"); hindi = hindi.replaceAll("EE", "\u0908"); hindi = hindi.replaceAll("oo", "\u0942"); hindi = hindi.replaceAll("OO", "\u090A"); hindi = hindi.replaceAll("RRi", "\u090B"); hindi = hindi.replaceAll("Ri", "\u0943"); hindi = hindi.replaceAll("LLi", "\u090C"); hindi = hindi.replaceAll("i", "\u093F"); hindi = hindi.replaceAll("I", "\u0907"); hindi = hindi.replaceAll("e", "\u0947"); hindi = hindi.replaceAll("E", "\u090F"); hindi = hindi.replaceAll("au", "\u094C"); hindi = hindi.replaceAll("AU", "\u0914"); hindi = hindi.replaceAll("ou", "\u094C"); hindi = hindi.replaceAll("OU", "\u0914"); hindi = hindi.replaceAll("u", "\u0941"); hindi = hindi.replaceAll("U", "\u0909"); hindi = hindi.replaceAll("o", "\u094B"); hindi = hindi.replaceAll("O", "\u0913"); hindi = hindi.replaceAll("aM", "\u0905\u0902"); hindi = hindi.replaceAll("aH", "\u0905\u0903"); hindi = hindi.replaceAll("a", "\u093E"); hindi = hindi.replaceAll("A", "\u0905"); } try { return new String(hindi.getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { return null; } catch (NullPointerException ex) { return null; } }} About.java About.java Java package jeditor; /** * * @author Rajesh Kumar Sahanee */ public class About extends javax.swing.JFrame { /** Creates new form sprite */ public About() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel2 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setAlwaysOnTop(true); setBackground(new java.awt.Color(255, 204, 204)); setLocationByPlatform(true); setUndecorated(true); jPanel2.setBackground(new java.awt.Color(153, 0, 153)); jLabel6.setForeground(new java.awt.Color(204, 204, 255)); jLabel6.setText("java files but you can"); jLabel3.setForeground(new java.awt.Color(153, 153, 255)); jLabel3.setText("Description:"); jLabel4.setForeground(new java.awt.Color(204, 204, 255)); jLabel4.setText("This Editor is designed"); jLabel5.setForeground(new java.awt.Color(204, 204, 255)); jLabel5.setText("to edit or create new"); jLabel7.setForeground(new java.awt.Color(204, 204, 255)); jLabel7.setText("also create and edit"); jLabel1.setForeground(new java.awt.Color(204, 204, 255)); jLabel1.setText("JEditor 1.0.0"); jLabel2.setForeground(new java.awt.Color(204, 0, 255)); jLabel2.setText("Developed by Rajesh Kumar Sahanee"); jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logo.gif"))); // NOI18N jLabel8.setForeground(new java.awt.Color(204, 204, 255)); jLabel8.setText("other files too"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(4, 4, 4) .addComponent(jLabel1)) .addComponent(jLabel2)) .addGap(15, 15, 15)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel9)) .addGap(2, 2, 2) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> /** * @param args the command line arguments */ // Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel2; // End of variables declaration } 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 package jeditor; /** * * @author Rajesh Kumar Sahanee */public class About extends javax.swing.JFrame { /** Creates new form sprite */ public About() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel2 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setAlwaysOnTop(true); setBackground(new java.awt.Color(255, 204, 204)); setLocationByPlatform(true); setUndecorated(true); jPanel2.setBackground(new java.awt.Color(153, 0, 153)); jLabel6.setForeground(new java.awt.Color(204, 204, 255)); jLabel6.setText("java files but you can"); jLabel3.setForeground(new java.awt.Color(153, 153, 255)); jLabel3.setText("Description:"); jLabel4.setForeground(new java.awt.Color(204, 204, 255)); jLabel4.setText("This Editor is designed"); jLabel5.setForeground(new java.awt.Color(204, 204, 255)); jLabel5.setText("to edit or create new"); jLabel7.setForeground(new java.awt.Color(204, 204, 255)); jLabel7.setText("also create and edit"); jLabel1.setForeground(new java.awt.Color(204, 204, 255)); jLabel1.setText("JEditor 1.0.0"); jLabel2.setForeground(new java.awt.Color(204, 0, 255)); jLabel2.setText("Developed by Rajesh Kumar Sahanee"); jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logo.gif"))); // NOI18N jLabel8.setForeground(new java.awt.Color(204, 204, 255)); jLabel8.setText("other files too"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(4, 4, 4) .addComponent(jLabel1)) .addComponent(jLabel2)) .addGap(15, 15, 15)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel9)) .addGap(2, 2, 2) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> /** * @param args the command line arguments */ // Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel2; // End of variables declaration } Output/Screenshot Download NetBeans Project Text Editor in Java 1 file(s) 136.17 KB Download Thanks