SlideShare a Scribd company logo
Elanthendral.M (HDCA)


                 11.Develop a programmer’s editor in java that supports
                     syntaxhighlighting, compilation support ,debugging
                                                          support,ect…


Aim :-
         To Develop a programmer’s editor in java that supports Syntax Highlighting ,
            compilation support , Debugging support.


Algorithm:-
I Syntax Highlighting
 1.1 Definition:-
     Definition
        Syntax highlighting is a feature of some text editors, that display text-
           especially Source code in different colors and fonts according to the
           category of terms.

  1.2 Introduction:-
   i.   This feature eases writing in a structured language such as a
        programming language or a markup language as both structures and
        syntax error are visually distinct.
  ii.   Highlighting does not affect the meaning of the text itself; it’s made only for
        human readers/editors
 iii.   Syntax highlighting is a form of secondary notation, since the highlights are
        not part of the text meaning, but serve to reinforce it. Some editor also integrate
        syntax highlighting with other features, such Highlighting with other features ,
        such as spell checking or code folding , as aids to editing which are
        external to the language.

   1.3 Procedure:-
   i.   Create a repository of sorts that would store all of the style changes that must
        be made to the document, and when the write lock is lifted , perform the
        changes. I’ve made the repository , and I’ve tried to make the changes just
        before painting the control , but that doesn’t work .Can anyone suggest a better
        time to perform the changes?
ii.    Start up a new thread that waits for the write lock to be lifted , and , when it is
         performs the changes . I’m not extremely familiar with threading in java ,
         through , so anyone who wants to give me a solution using this method need to
         be very explicit and verbose.
 iii.    Any other simple way that doesn’t involve using something other than
         JTextArea.




II Compilation
  2. 1 Definition:-
   i.    A compiler is a computer program (or set of programs) that transforms
         source code written in a programming language (the source language) into
         another computer language (the target language, often having a binary form
         known as object code). The most common reason for wanting to transform
         source code is to create an executable program
  ii.    Translate a (high level) language program into an equivalent assembly language
         program.

  2.2Java compilation
   i.    Source code java is compiled into “bytecode” instead of machine code.
  ii.    bytecode is executed by the virtual machine , it is device independent.
 iii.    Bytecode : assembly + types + object oriented layer.



  2.3 Introduction:-
  2.4Two main parts the compilation
   i.    To understand the program.
  ii.    To translate it into machine code.

        2.4.1 Understanding programs
           Procedure :-
            At the beginning a program is just a text:
                i.   Cut the sequence into words(lexical analysis)
               ii.   Organize words into sentences(syntactic analysis,parsing)
              iii.   Encodes the meaning of sentences

         Close to the understanding of natural languages , for natural language , start with a
flow of sounds
2.4.2 Generate machine programs
   Procedure :-
            i.   Produce machine code realizing the original program.
           ii.   Decompose complex abstract operations of the program into
                 sequences of simple , basic machine instruction.
          iii.   Optimize the program.


III Debugging :-

3. Definition:-
   A Degugger or Debugging tool is a computer program that is used to test and
          debug other programs (the “target” program ). The code to be examined
          might alternatively be running on an instruction set simulator(ISS), a
          technique that allows great power in its ability to halt when specific
          conditions are encountered but which will typically be somewhat slower
          than executing slower than executing the code directly on the appropriate
          (or the same). Some debugger offer two modes of operation – full or partial
          simulation , to limit this impact.


IV Tool Tips:-
     i.   Creating a tool tip for any Jcomponent object is easy .use the

                         Picture   Picture name     Tooltip name

                                     NEW            new.gif
                                     Open           open.gif
                                     Save           save.gif
                                     Copy           copy.gif
                                      Cut             cut.gif
                                      Past           past.gif
          setToolTipText method to set up a tool tip for the component .
    ii.   In this program we use the this type of the ToolTip;
V Task Manager
                In this project we use task manager


5.1 how to get the running applications in windows task manager using
java
    Why are you doing System type stuff using Java? It is not designed for it. If you
           want a command line command to get the "application" list that appears
           in TaskManager




5.2 What is task manager:-
  i.   Task Manager provides information about programs and processes running on
       your computer. It also displays the most commonly used performance measures
       for processes.
ii.          You can use Task Manager to monitor key indicators of your computer's
               performance. You can see the status of the programs that are running and end
               programs that have stopped responding. You can also assess the activity of
               running processes using as many as fifteen parameters, and see graphs and data
               on CPU and memory usage.
 iii.          In addition, if you are connected to a network, you can view network status and
               see how your network is functioning.
 iv.           If you have more than one user connected to your computer, you can see who is
               connected, what they are working on, and you can send them a message.




5.3 Programs that are running
   i.          The Applications tab shows the status of the programs running on your
               computer.
  ii.          On this tab, you can end, switch to, or start a program.

5.4 Processes that are running
  i.           The Processes tab shows information about the processes running on your
               computer.
 ii.           For example, you can display information on CPU and memory usage, page faults,
               handle count, and a number of other parameters.

5.5 Performance measures
        The Performance tab displays a dynamic overview of your computer's
              performance, including:

          i.      Graphs for CPU and memory usage.
         ii.      Totals for the number of handles, threads, and processes running on
                  your computer.
        iii.      Totals, in kilobytes, for physical, kernel, and commit memory.

5.6 Viewing Network performance
   i.          The Networking tab displays a graphical representation of network
               performance. It provides a simple, qualitative indicator that shows the status of
               the network(s) that are running on your computer. The Networking tab is
               displayed only if a network card is present.
  ii.          On this tab, you can view the quality and availability of your network
               connection, whether you are connected to one or more than one network.
5.7Monitoring Sessions
  i.   The Users tab displays users who can access this computer, and session status
       and names. Client Name specifies the name of the client computer using the
       session, if applicable. Session provides a name for you to use to perform such
       tasks as sending another user a message or connecting to another user’s session.
 ii.   The Users tab is displayed only if the computer you are working on has Fast User
       Switching enabled, and is a member of a workgroup or is a standalone computer.
       The Users tab is unavailable on computers that are members of a network domain.




Program :-

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;


/**
 * This class demonstrates Debugging,Syntax HighLighting,Compling
 * @author E.Annal Sheeba Rani
 * @Version jdk1.6
 */


public class sw1 extends JFrame implements ActionListener,
KeyListener
{

       // A frame with text field and Label field

JToolBar tb = new JToolBar();

       // icf & b1 an array of values.

String icf[] =
{"new.gif","open.gif","save.gif","cut.gif","copy.gif","paste.gif"};
// b1 represents for Tooltip

String bl[] = {"New","Open","Save","Cut","Copy","Paste"};

     // Demonstrate a one-dimensional array

ImageIcon ic[] = new ImageIcon[icf.length];

     // use a lable to display syntax highlighting

Label l1 = new Label("Syntax Highlighting");
JButton mbl[] = new JButton[icf.length];

     // set up manu bar

MenuBar mbar = new MenuBar();
Menu a = new Menu("File");
Menu b = new Menu("Edit");
Menu c = new Menu("Font");
Menu d = new Menu("Font-Size");
Menu f = new Menu("System");
int fsize = 13;                                // assigns fsize the
Value 13
JTextArea ta,ta1;
JScrollPane js1;

// create a fontList using GraphicsEnvironment

String fontList[] =
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFo
ntFamilyNames();

// create MenuItem

MenuItem m[] = new MenuItem[fontList.length];
MenuItem fs[] = new MenuItem[600];
MenuItem a1 = new MenuItem("New");
MenuItem a2 = new MenuItem("Open");
MenuItem a3 = new MenuItem("Save");
MenuItem a4 = new MenuItem("Save as");
MenuItem a5 = new MenuItem("-");
MenuItem a6 = new MenuItem("Exit");
MenuItem b1 = new MenuItem("Cut");
MenuItem b2 = new MenuItem("Copy");
MenuItem b3 = new MenuItem("Paste");
MenuItem d1 = new MenuItem("Compile");
MenuItem d2 = new MenuItem("Run");
String ck="";
int i;
public sw1()
{
       super("Java Editor");                  //set title
          setSize(1024,768);               //assign a layoutsize
           setLayout(null);
           ta=new JTextArea(10,10);
           js1=new JScrollPane(ta);
           ta1=new JTextArea(5,60);
           add(js1);add(ta);add(ta1);add(tb);
       a.add(a1);add(l1);
       a.add(a2);
       a.add(a3);
       a.add(a4);
       a.add(a5);
       a.add(a6);
       b.add(b1);
       b.add(b2);
       b.add(b3);

         f.add(d1);
         f.add(d2);

     mbar.add(a);
     mbar.add(b);
     mbar.add(c);
     mbar.add(d);
     mbar.add(f);
     setMenuBar(mbar);


// loop for FontList
for (i = 0; i < fontList.length; i++ )
 {
  m[i] = new MenuItem(fontList[i]);
  m[i].addActionListener(this);
  m[i].setActionCommand(""+i);
  c.add(m[i]);
  }


// loop for MenuItem


for (i = 8; i <=90 ; i+=2)
 {
  fs[i] = new MenuItem(String.valueOf(i));
  fs[i].addActionListener(new fs());
  d.add(fs[i]);
  }

//loop for ImageIcone


     for( i =0;i<bl.length;i++)
     {
     ic[i ]= new ImageIcon(icf[i]);

     mbl[i] = new JButton(ic[i]);

     mbl[i].setToolTipText(bl[i]);

           mbl[i].addActionListener(this);

     mbl[i].setActionCommand("z"+i);

     if(i==3) tb.addSeparator();
     tb.add(mbl[i]);
     }
           tb.reshape(0,0,500,35);
           ta.reshape(5,40,1005,500);
js1.reshape(5,4,100,35);



     // set foregroundcolor for l1 that is Syntax Highlighting

     l1.setForeground(Color.green);

     // set foregroundcolor for ta that is text area

    ta.setForeground(Color.blue);
    l1.reshape(400,550,130,30);
    ta1.reshape(5,600,1005,200);
    ta1.setForeground(Color.red);
add(tb);

     add(ta);
     add(js1);
     add(l1);

     // This Listener can performed in wh object

     a6.addWindowListener(new wh());


     // This Listener can be performed in this object


a1.addActionListener(this);
a2.addActionListener(this);
a3.addActionListener(this);
a4.addActionListener(this);

     // This Listener can be performed in wc object


a5.addActionListener(new wc());
b1.addActionListener(new wc());
b2.addActionListener(new wc());
b3.addActionListener(new wc());
d1.addActionListener(new wc());
d2.addActionListener(new wc());
     ta.addKeyListener(this);
     show();
}


//set button action


public class wh extends WindowAdapter {
  public void windowClosing(WindowEvent e) {
       System.exit(0);
}
}


           // an ActionListener that sets the FontSize


public class fs implements ActionListener {
 public void actionPerformed(ActionEvent e) {
fsize = Integer.parseInt(e.getActionCommand());
  System.out.println(fsize);
}}

public class wc implements ActionListener {
public void actionPerformed(ActionEvent e) {


           // create button actions

String cmd= e.getActionCommand();


           // associate actions with buttons


if (cmd.equals("Exit")) System.exit(0);
if (cmd.equals("Cut")) ta.cut();
if (cmd.equals("Copy")) ta.copy();
if (cmd.equals("Paste")) ta.paste();
if (cmd.equals("Save"))
{
}
if (cmd.equals("Compile"))
    {
   try {
Runtime rt= Runtime.getRuntime();
Process p= rt.exec("taskmgr.exe");
    }
 catch(Exception ea) {
  System.out.println("Error");
}
    }
     }
   }
 public void keyReleased(KeyEvent ke){}
 public void keyPressed(KeyEvent ke){}
 public void keyTyped(KeyEvent ke)
 {


     // create a KeyPressed , KeyReleased, Key Typed

 Character k = ke.getKeyChar();
 int mk = (int) k;
 System.out.println(mk);
 ck += k;

          // create KeyReleased action

 if (ck.equals("for "))
   {
   ta1.setText("");
   ta1.append("for(var=init;condition;incr/decr)n");
   ta1.append("{n");
   ta1.append(" set of statements;n");
   ta1.append("}n");
   ck="";
   }
if (ck.equals("if "))
  {
  ta1.setText("");
  ta1.append("if (condition)n");
  ta1.append("{n");
  ta1.append(" set of statements;n");
  ta1.append("}n");
  ta1.append("elsen");
  ta1.append("{n");
  ta1.append(" set of statements;n");
  ta1.append("}n");
  ck = "";
  }

if (ck.equals("do "))
  {
  ta1.setText("");
  ta1.append("don");
  ta1.append("{n");
  ta1.append(" set of statements;n");
  ta1.append("}n");
  ta1.append("while (condition);n");
  ck = "";
  }

if (ck.equals("while "))
  {
  ta1.setText("");
  ta1.append("while(condition)n");
  ta1.append("{n");
  ta1.append(" set of statements;n");
  ta1.append("}n");
  ck = "";
  }

 if (mk == 10 || mk == 32 || mk == 8 || mk == 9) ck ="";
}

          //to create Button Link
public void actionPerformed(ActionEvent ae)
{
 String s1 = (String) ae.getActionCommand();
int ck1=1;
 System.out.println(s1);

if (s1.equals("z0"))
 {
 ta.setText("");ck1=0;
 }

if (s1.equals("z3"))
 {
    ta.cut();ck1=0;
 }

if (s1.equals("z4"))
 {
    ta.copy();ck1=0;
 }


if (s1.equals("z5"))
 {
    ta.paste();ck1=0;
 }


if (s1.equals("z1"))
 {

// for open a file menu

   FileDialog fx = new FileDialog(this,"Open a File",FileDialog.LOAD);
   fx.setDirectory("d:jeditor");
   fx.setFile("*.*");
   fx.show();
   String mfname=fx.getDirectory()+fx.getFile();
   setTitle(mfname);
   File fx1=new File(mfname);
try
   {
       FileInputStream fis=new FileInputStream(fx1);
       int fsize=(int) fx1.length();
       byte d[] =new byte[fsize];
       fis.read(d);
       ta.setText("");
       ta.setText(new String(d));
    }
    catch(Exception ex){};
    ck1=0;
}


if (s1.equals("z2"))
 {

             // for open a save menu bar

 FileDialog f=new FileDialog(this,"Save a File",FileDialog.SAVE);
    f.setDirectory("d:jeditor");
    f.setFile("*.java");
    f.show();
    String fname=f.getDirectory()+f.getFile();
    setTitle(fname);
    File f1=new File(fname);
    try
    {
      FileOutputStream fos=new FileOutputStream(f1);
      String t=ta.getText();
      int fsize=t.length();
      byte[] d=new byte[fsize];
      t.getBytes(0,fsize,d,0);
      fos.write(d);
      fos.close();
    }
    catch(Exception e){};
    ck1=0;
}
if ((s1.compareTo("Open") != 0) && (s1.compareTo("Save")) != 0 &&
(s1.compareTo("New") != 0) && (s1.compareTo("Save as") != 0 &&
(ck1 == 1)))
  {
  int x = Integer.parseInt(ae.getActionCommand());
  String fname = fontList[x];
  Font f1 = new Font(fname,Font.BOLD,fsize);
  ta.setFont(f1);
 }


if (s1.equals("Open"))
{

     // for open a open menu bar

   FileDialog fx = new FileDialog(this,"Open a File",FileDialog.LOAD);
   fx.setDirectory("d:jeditor");
   fx.setFile("*.*");
   fx.show();
   String mfname=fx.getDirectory()+fx.getFile();
   setTitle(mfname);
   File fx1=new File(mfname);
try
   {
     FileInputStream fis=new FileInputStream(fx1);
     int fsize=(int) fx1.length();
     byte d[] =new byte[fsize];
     fis.read(d);
     ta.setText("");
     ta.setText(new String(d));
   }
   catch(Exception ex){};

}

if (s1.equals("New"))
{
 ta.setText("");
}
if (s1.equals("Save") || s1.equals("Save as"))
{

             // for open a save or saveas menu bar

    FileDialog f=new FileDialog(this,"Save a File",FileDialog.SAVE);
       f.setDirectory("d:jeditor");
       f.setFile("*.java");
       f.show();
       String fname=f.getDirectory()+f.getFile();
       setTitle(fname);
       File f1=new File(fname);
       try
       {
         FileOutputStream fos=new FileOutputStream(f1);
         String t=ta.getText();
         int fsize=t.length();
         byte[] d=new byte[fsize];
         t.getBytes(0,fsize,d,0);
         fos.write(d);
         fos.close();
       }
       catch(Exception e){};
}

}


public static void main(String args[])
{
  sw1 app = new sw1();
}
}
Out put:-
The output layout




The file menu out put:-

    In this file menu we can do the following performances. there are:-
                    i. Create a New file
                   ii. Open a file
iii.   Save a file
                      iv.    Save as a file
                       v.    Exit




Performances for the file menu:-
1: create a new file
     To create our new file , we can do following instruction

   1. On the File menu, click New.
   2. In the New Document task pane, under New, click From existing document.
   3. Click the document you want to create a new document from. If you want to open a
      document that was saved in a different folder, locate and open the folder.
   4. Click Create New.

      This document is created in the folder that contains the original document.


2. Open a file
      To open a file , we can do following instruction

   1. click File, and then click Open.
   2. In the Look in list, click the drive, folder, or Internet location that contains the file
      you want to open.
   3. In the folder list, locate and open the folder that contains the file.
   4. Click the file, and then click Open.
I.Save a file
  •   On the File menu, click Save.
  •   In the File name box, enter a new name for the file.
  •   Click Save.




Saveas a file
  1. On the File menu, click Save as.
  2. In the File name box, enter a new name for the file.
  3. Click the Save as type drop-down list, and then click the file format that you want
     the file saved in.



The out put for edit menu
                   The edit menu is also perform the following Idem
                          There are:-
                       i. Cut
                      ii. Copy
                     iii. Paste
II. Copy a file

   1. On the Standard toolbar, click Open             .
   2. Click a shortcut on the Places Bar, or in the Look in box, click the drive or folder
      that contains the file you want to copy.
   3. In the folder list, locate and open the folder that contains the file you want to copy.
   4. Right-click the file you want to copy, and then click Copy on the shortcut menu.
   5. In the Look in box, click the drive or folder you want to copy the file to.
   6. In the folder list, locate and open the folder you want to copy the file to.
   7. Right-click anywhere in the folder list (make sure your pointer is not resting over a file in
      the list), and then click Paste on the shortcut menu.

III.Cut and Paste a file

   1. On the Standard toolbar, click Open           .
   2. Click a shortcut on the Places Bar, or in the Look in box, click the drive or folder
      that contains the file you want to move.
   3. In the folder list, locate and open the folder that contains the file you want to move.
   4. Right-click the file you want to move, and then click Cut on the shortcut menu.
   5. In the Look in box, click the drive or folder you want to move the file to.
   6. In the folder list, locate and open the folder you want to move the file to.
   7. Right-click anywhere in the folder list (make sure your pointer is not resting over a
      file in the list), and then click Paste on the shortcut menu.


The output for syntaxhighlighting
    IF WE WANT THE OUTPUT FOR syntaxhighlighting WE FOLLOW THE
FOLLOWING COMMANDS:-
AT FIRST WE TYPE THE WORD ,FOR EXAMPLE WE WANT THE SYNTAX FOR ‘if’
              Type the if in text area
              Then pressed the spaces bar
              Then syntax can be apper in the syntaxhighligthing text.
The out put for system




 Procedure for compilation :-
    First write a program.
    Then click systemcompile.




                                   The Task Manager Dialog box can
                                    be opened.
                                   Then click filecompile.
 Task Manager dialog box can be apper.




 Then go to file menu in the Task Manager.
 Select NEW TASK(RUN…) ,then Run dialog box can be apper.




 Enter “cmd” and click ok button.
 Know we can run it.




 Thus we execute the program.

More Related Content

What's hot

computer Unit 6
computer Unit 6computer Unit 6
computer Unit 6
Aqeel Rehman
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
Prashanth Shivakumar
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIwhite paper
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05Niit Care
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
Alok Jain
 
09 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_1309 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_13Niit Care
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
shahzadebaujiti
 
Java Programming Assignment
Java Programming AssignmentJava Programming Assignment
Java Programming Assignment
Vijayananda Mohire
 
Ppt chapter01
Ppt chapter01Ppt chapter01
Ppt chapter01
Richard Styner
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
Keerty Smile
 
Chapter 13.1.4
Chapter 13.1.4Chapter 13.1.4
Chapter 13.1.4patcha535
 
Object Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert HarleObject Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert Harle
suthi
 
Java session11
Java session11Java session11
Java session11Niit Care
 
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESOBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
suthi
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdpMohd Arif
 
11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16Niit Care
 

What's hot (20)

computer Unit 6
computer Unit 6computer Unit 6
computer Unit 6
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging API
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
main
mainmain
main
 
09 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_1309 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_13
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 
Java Programming Assignment
Java Programming AssignmentJava Programming Assignment
Java Programming Assignment
 
Ppt chapter01
Ppt chapter01Ppt chapter01
Ppt chapter01
 
01 gui 01
01 gui 0101 gui 01
01 gui 01
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
Chapter 13.1.4
Chapter 13.1.4Chapter 13.1.4
Chapter 13.1.4
 
Object Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert HarleObject Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert Harle
 
Java session11
Java session11Java session11
Java session11
 
Richa garg itm
Richa garg itmRicha garg itm
Richa garg itm
 
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESOBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdp
 
Savitch ch 01
Savitch ch 01Savitch ch 01
Savitch ch 01
 
11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16
 

Viewers also liked

Autonomic computer
Autonomic computerAutonomic computer
Autonomic computer
Elanthendral Mariappan
 
Routing security in ad hoc wireless network
Routing security in ad hoc wireless networkRouting security in ad hoc wireless network
Routing security in ad hoc wireless network
Elanthendral Mariappan
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
Helge Tennø
 

Viewers also liked (9)

Autonomic computer
Autonomic computerAutonomic computer
Autonomic computer
 
Autonomic computer
Autonomic computerAutonomic computer
Autonomic computer
 
Cybercrimes
CybercrimesCybercrimes
Cybercrimes
 
Ex3 lisp likelist in java
Ex3 lisp likelist in javaEx3 lisp likelist in java
Ex3 lisp likelist in java
 
Packet filtering using jpcap
Packet filtering using jpcapPacket filtering using jpcap
Packet filtering using jpcap
 
Image+processing
Image+processingImage+processing
Image+processing
 
Routing security in ad hoc wireless network
Routing security in ad hoc wireless networkRouting security in ad hoc wireless network
Routing security in ad hoc wireless network
 
Ad-HOc presentation
Ad-HOc presentationAd-HOc presentation
Ad-HOc presentation
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Similar to Ex11 mini project

Java Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage EssayJava Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage Essay
Liz Sims
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
DivyaR219113
 
Java Chapter 2 Overview.ppt
Java Chapter 2 Overview.pptJava Chapter 2 Overview.ppt
Java Chapter 2 Overview.ppt
MiltonMolla1
 
Java Chapter 2 Overview.ppt
Java Chapter 2 Overview.pptJava Chapter 2 Overview.ppt
Java Chapter 2 Overview.ppt
MiltonMolla1
 
Introduction to system programming
Introduction to system programmingIntroduction to system programming
Introduction to system programming
sonalikharade3
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdf
vino108206
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
Gaurav Singh
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
Zeeshan MIrza
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
ssuserf86fba
 
CSO Laboratory Manual
CSO Laboratory ManualCSO Laboratory Manual
CSO Laboratory Manual
Dwight Sabio
 
ID E's features
ID E's featuresID E's features
ID E's features
wajahat Gul
 
Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021
WrapPixel
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
Jerry Kurian
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
Mikkel Flindt Heisterberg
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
suneel singh
 
Review Paper on Online Java Compiler
Review Paper on Online Java CompilerReview Paper on Online Java Compiler
Review Paper on Online Java Compiler
IRJET Journal
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
Jaya Kumari
 
.Net framework
.Net framework.Net framework
.Net frameworkRaghu nath
 

Similar to Ex11 mini project (20)

Java Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage EssayJava Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage Essay
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Build tools
Build toolsBuild tools
Build tools
 
Build tools
Build toolsBuild tools
Build tools
 
Java Chapter 2 Overview.ppt
Java Chapter 2 Overview.pptJava Chapter 2 Overview.ppt
Java Chapter 2 Overview.ppt
 
Java Chapter 2 Overview.ppt
Java Chapter 2 Overview.pptJava Chapter 2 Overview.ppt
Java Chapter 2 Overview.ppt
 
Introduction to system programming
Introduction to system programmingIntroduction to system programming
Introduction to system programming
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdf
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
 
CSO Laboratory Manual
CSO Laboratory ManualCSO Laboratory Manual
CSO Laboratory Manual
 
ID E's features
ID E's featuresID E's features
ID E's features
 
Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
 
Review Paper on Online Java Compiler
Review Paper on Online Java CompilerReview Paper on Online Java Compiler
Review Paper on Online Java Compiler
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
.Net framework
.Net framework.Net framework
.Net framework
 

Recently uploaded

The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 

Ex11 mini project

  • 1. Elanthendral.M (HDCA) 11.Develop a programmer’s editor in java that supports syntaxhighlighting, compilation support ,debugging support,ect… Aim :- To Develop a programmer’s editor in java that supports Syntax Highlighting , compilation support , Debugging support. Algorithm:- I Syntax Highlighting 1.1 Definition:- Definition Syntax highlighting is a feature of some text editors, that display text- especially Source code in different colors and fonts according to the category of terms. 1.2 Introduction:- i. This feature eases writing in a structured language such as a programming language or a markup language as both structures and syntax error are visually distinct. ii. Highlighting does not affect the meaning of the text itself; it’s made only for human readers/editors iii. Syntax highlighting is a form of secondary notation, since the highlights are not part of the text meaning, but serve to reinforce it. Some editor also integrate syntax highlighting with other features, such Highlighting with other features , such as spell checking or code folding , as aids to editing which are external to the language. 1.3 Procedure:- i. Create a repository of sorts that would store all of the style changes that must be made to the document, and when the write lock is lifted , perform the changes. I’ve made the repository , and I’ve tried to make the changes just before painting the control , but that doesn’t work .Can anyone suggest a better time to perform the changes?
  • 2. ii. Start up a new thread that waits for the write lock to be lifted , and , when it is performs the changes . I’m not extremely familiar with threading in java , through , so anyone who wants to give me a solution using this method need to be very explicit and verbose. iii. Any other simple way that doesn’t involve using something other than JTextArea. II Compilation 2. 1 Definition:- i. A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program ii. Translate a (high level) language program into an equivalent assembly language program. 2.2Java compilation i. Source code java is compiled into “bytecode” instead of machine code. ii. bytecode is executed by the virtual machine , it is device independent. iii. Bytecode : assembly + types + object oriented layer. 2.3 Introduction:- 2.4Two main parts the compilation i. To understand the program. ii. To translate it into machine code. 2.4.1 Understanding programs Procedure :- At the beginning a program is just a text: i. Cut the sequence into words(lexical analysis) ii. Organize words into sentences(syntactic analysis,parsing) iii. Encodes the meaning of sentences Close to the understanding of natural languages , for natural language , start with a flow of sounds
  • 3. 2.4.2 Generate machine programs Procedure :- i. Produce machine code realizing the original program. ii. Decompose complex abstract operations of the program into sequences of simple , basic machine instruction. iii. Optimize the program. III Debugging :- 3. Definition:- A Degugger or Debugging tool is a computer program that is used to test and debug other programs (the “target” program ). The code to be examined might alternatively be running on an instruction set simulator(ISS), a technique that allows great power in its ability to halt when specific conditions are encountered but which will typically be somewhat slower than executing slower than executing the code directly on the appropriate (or the same). Some debugger offer two modes of operation – full or partial simulation , to limit this impact. IV Tool Tips:- i. Creating a tool tip for any Jcomponent object is easy .use the Picture Picture name Tooltip name NEW new.gif Open open.gif Save save.gif Copy copy.gif Cut cut.gif Past past.gif setToolTipText method to set up a tool tip for the component . ii. In this program we use the this type of the ToolTip;
  • 4. V Task Manager In this project we use task manager 5.1 how to get the running applications in windows task manager using java Why are you doing System type stuff using Java? It is not designed for it. If you want a command line command to get the "application" list that appears in TaskManager 5.2 What is task manager:- i. Task Manager provides information about programs and processes running on your computer. It also displays the most commonly used performance measures for processes.
  • 5. ii. You can use Task Manager to monitor key indicators of your computer's performance. You can see the status of the programs that are running and end programs that have stopped responding. You can also assess the activity of running processes using as many as fifteen parameters, and see graphs and data on CPU and memory usage. iii. In addition, if you are connected to a network, you can view network status and see how your network is functioning. iv. If you have more than one user connected to your computer, you can see who is connected, what they are working on, and you can send them a message. 5.3 Programs that are running i. The Applications tab shows the status of the programs running on your computer. ii. On this tab, you can end, switch to, or start a program. 5.4 Processes that are running i. The Processes tab shows information about the processes running on your computer. ii. For example, you can display information on CPU and memory usage, page faults, handle count, and a number of other parameters. 5.5 Performance measures The Performance tab displays a dynamic overview of your computer's performance, including: i. Graphs for CPU and memory usage. ii. Totals for the number of handles, threads, and processes running on your computer. iii. Totals, in kilobytes, for physical, kernel, and commit memory. 5.6 Viewing Network performance i. The Networking tab displays a graphical representation of network performance. It provides a simple, qualitative indicator that shows the status of the network(s) that are running on your computer. The Networking tab is displayed only if a network card is present. ii. On this tab, you can view the quality and availability of your network connection, whether you are connected to one or more than one network.
  • 6. 5.7Monitoring Sessions i. The Users tab displays users who can access this computer, and session status and names. Client Name specifies the name of the client computer using the session, if applicable. Session provides a name for you to use to perform such tasks as sending another user a message or connecting to another user’s session. ii. The Users tab is displayed only if the computer you are working on has Fast User Switching enabled, and is a member of a workgroup or is a standalone computer. The Users tab is unavailable on computers that are members of a network domain. Program :- import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; /** * This class demonstrates Debugging,Syntax HighLighting,Compling * @author E.Annal Sheeba Rani * @Version jdk1.6 */ public class sw1 extends JFrame implements ActionListener, KeyListener { // A frame with text field and Label field JToolBar tb = new JToolBar(); // icf & b1 an array of values. String icf[] = {"new.gif","open.gif","save.gif","cut.gif","copy.gif","paste.gif"};
  • 7. // b1 represents for Tooltip String bl[] = {"New","Open","Save","Cut","Copy","Paste"}; // Demonstrate a one-dimensional array ImageIcon ic[] = new ImageIcon[icf.length]; // use a lable to display syntax highlighting Label l1 = new Label("Syntax Highlighting"); JButton mbl[] = new JButton[icf.length]; // set up manu bar MenuBar mbar = new MenuBar(); Menu a = new Menu("File"); Menu b = new Menu("Edit"); Menu c = new Menu("Font"); Menu d = new Menu("Font-Size"); Menu f = new Menu("System"); int fsize = 13; // assigns fsize the Value 13 JTextArea ta,ta1; JScrollPane js1; // create a fontList using GraphicsEnvironment String fontList[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFo ntFamilyNames(); // create MenuItem MenuItem m[] = new MenuItem[fontList.length]; MenuItem fs[] = new MenuItem[600]; MenuItem a1 = new MenuItem("New"); MenuItem a2 = new MenuItem("Open"); MenuItem a3 = new MenuItem("Save"); MenuItem a4 = new MenuItem("Save as");
  • 8. MenuItem a5 = new MenuItem("-"); MenuItem a6 = new MenuItem("Exit"); MenuItem b1 = new MenuItem("Cut"); MenuItem b2 = new MenuItem("Copy"); MenuItem b3 = new MenuItem("Paste"); MenuItem d1 = new MenuItem("Compile"); MenuItem d2 = new MenuItem("Run"); String ck=""; int i; public sw1() { super("Java Editor"); //set title setSize(1024,768); //assign a layoutsize setLayout(null); ta=new JTextArea(10,10); js1=new JScrollPane(ta); ta1=new JTextArea(5,60); add(js1);add(ta);add(ta1);add(tb); a.add(a1);add(l1); a.add(a2); a.add(a3); a.add(a4); a.add(a5); a.add(a6); b.add(b1); b.add(b2); b.add(b3); f.add(d1); f.add(d2); mbar.add(a); mbar.add(b); mbar.add(c); mbar.add(d); mbar.add(f); setMenuBar(mbar); // loop for FontList
  • 9. for (i = 0; i < fontList.length; i++ ) { m[i] = new MenuItem(fontList[i]); m[i].addActionListener(this); m[i].setActionCommand(""+i); c.add(m[i]); } // loop for MenuItem for (i = 8; i <=90 ; i+=2) { fs[i] = new MenuItem(String.valueOf(i)); fs[i].addActionListener(new fs()); d.add(fs[i]); } //loop for ImageIcone for( i =0;i<bl.length;i++) { ic[i ]= new ImageIcon(icf[i]); mbl[i] = new JButton(ic[i]); mbl[i].setToolTipText(bl[i]); mbl[i].addActionListener(this); mbl[i].setActionCommand("z"+i); if(i==3) tb.addSeparator(); tb.add(mbl[i]); } tb.reshape(0,0,500,35); ta.reshape(5,40,1005,500);
  • 10. js1.reshape(5,4,100,35); // set foregroundcolor for l1 that is Syntax Highlighting l1.setForeground(Color.green); // set foregroundcolor for ta that is text area ta.setForeground(Color.blue); l1.reshape(400,550,130,30); ta1.reshape(5,600,1005,200); ta1.setForeground(Color.red); add(tb); add(ta); add(js1); add(l1); // This Listener can performed in wh object a6.addWindowListener(new wh()); // This Listener can be performed in this object a1.addActionListener(this); a2.addActionListener(this); a3.addActionListener(this); a4.addActionListener(this); // This Listener can be performed in wc object a5.addActionListener(new wc()); b1.addActionListener(new wc()); b2.addActionListener(new wc()); b3.addActionListener(new wc()); d1.addActionListener(new wc());
  • 11. d2.addActionListener(new wc()); ta.addKeyListener(this); show(); } //set button action public class wh extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(0); } } // an ActionListener that sets the FontSize public class fs implements ActionListener { public void actionPerformed(ActionEvent e) { fsize = Integer.parseInt(e.getActionCommand()); System.out.println(fsize); }} public class wc implements ActionListener { public void actionPerformed(ActionEvent e) { // create button actions String cmd= e.getActionCommand(); // associate actions with buttons if (cmd.equals("Exit")) System.exit(0); if (cmd.equals("Cut")) ta.cut(); if (cmd.equals("Copy")) ta.copy(); if (cmd.equals("Paste")) ta.paste();
  • 12. if (cmd.equals("Save")) { } if (cmd.equals("Compile")) { try { Runtime rt= Runtime.getRuntime(); Process p= rt.exec("taskmgr.exe"); } catch(Exception ea) { System.out.println("Error"); } } } } public void keyReleased(KeyEvent ke){} public void keyPressed(KeyEvent ke){} public void keyTyped(KeyEvent ke) { // create a KeyPressed , KeyReleased, Key Typed Character k = ke.getKeyChar(); int mk = (int) k; System.out.println(mk); ck += k; // create KeyReleased action if (ck.equals("for ")) { ta1.setText(""); ta1.append("for(var=init;condition;incr/decr)n"); ta1.append("{n"); ta1.append(" set of statements;n"); ta1.append("}n"); ck=""; }
  • 13. if (ck.equals("if ")) { ta1.setText(""); ta1.append("if (condition)n"); ta1.append("{n"); ta1.append(" set of statements;n"); ta1.append("}n"); ta1.append("elsen"); ta1.append("{n"); ta1.append(" set of statements;n"); ta1.append("}n"); ck = ""; } if (ck.equals("do ")) { ta1.setText(""); ta1.append("don"); ta1.append("{n"); ta1.append(" set of statements;n"); ta1.append("}n"); ta1.append("while (condition);n"); ck = ""; } if (ck.equals("while ")) { ta1.setText(""); ta1.append("while(condition)n"); ta1.append("{n"); ta1.append(" set of statements;n"); ta1.append("}n"); ck = ""; } if (mk == 10 || mk == 32 || mk == 8 || mk == 9) ck =""; } //to create Button Link
  • 14. public void actionPerformed(ActionEvent ae) { String s1 = (String) ae.getActionCommand(); int ck1=1; System.out.println(s1); if (s1.equals("z0")) { ta.setText("");ck1=0; } if (s1.equals("z3")) { ta.cut();ck1=0; } if (s1.equals("z4")) { ta.copy();ck1=0; } if (s1.equals("z5")) { ta.paste();ck1=0; } if (s1.equals("z1")) { // for open a file menu FileDialog fx = new FileDialog(this,"Open a File",FileDialog.LOAD); fx.setDirectory("d:jeditor"); fx.setFile("*.*"); fx.show(); String mfname=fx.getDirectory()+fx.getFile(); setTitle(mfname); File fx1=new File(mfname);
  • 15. try { FileInputStream fis=new FileInputStream(fx1); int fsize=(int) fx1.length(); byte d[] =new byte[fsize]; fis.read(d); ta.setText(""); ta.setText(new String(d)); } catch(Exception ex){}; ck1=0; } if (s1.equals("z2")) { // for open a save menu bar FileDialog f=new FileDialog(this,"Save a File",FileDialog.SAVE); f.setDirectory("d:jeditor"); f.setFile("*.java"); f.show(); String fname=f.getDirectory()+f.getFile(); setTitle(fname); File f1=new File(fname); try { FileOutputStream fos=new FileOutputStream(f1); String t=ta.getText(); int fsize=t.length(); byte[] d=new byte[fsize]; t.getBytes(0,fsize,d,0); fos.write(d); fos.close(); } catch(Exception e){}; ck1=0; }
  • 16. if ((s1.compareTo("Open") != 0) && (s1.compareTo("Save")) != 0 && (s1.compareTo("New") != 0) && (s1.compareTo("Save as") != 0 && (ck1 == 1))) { int x = Integer.parseInt(ae.getActionCommand()); String fname = fontList[x]; Font f1 = new Font(fname,Font.BOLD,fsize); ta.setFont(f1); } if (s1.equals("Open")) { // for open a open menu bar FileDialog fx = new FileDialog(this,"Open a File",FileDialog.LOAD); fx.setDirectory("d:jeditor"); fx.setFile("*.*"); fx.show(); String mfname=fx.getDirectory()+fx.getFile(); setTitle(mfname); File fx1=new File(mfname); try { FileInputStream fis=new FileInputStream(fx1); int fsize=(int) fx1.length(); byte d[] =new byte[fsize]; fis.read(d); ta.setText(""); ta.setText(new String(d)); } catch(Exception ex){}; } if (s1.equals("New")) { ta.setText(""); }
  • 17. if (s1.equals("Save") || s1.equals("Save as")) { // for open a save or saveas menu bar FileDialog f=new FileDialog(this,"Save a File",FileDialog.SAVE); f.setDirectory("d:jeditor"); f.setFile("*.java"); f.show(); String fname=f.getDirectory()+f.getFile(); setTitle(fname); File f1=new File(fname); try { FileOutputStream fos=new FileOutputStream(f1); String t=ta.getText(); int fsize=t.length(); byte[] d=new byte[fsize]; t.getBytes(0,fsize,d,0); fos.write(d); fos.close(); } catch(Exception e){}; } } public static void main(String args[]) { sw1 app = new sw1(); } }
  • 18. Out put:- The output layout The file menu out put:- In this file menu we can do the following performances. there are:- i. Create a New file ii. Open a file
  • 19. iii. Save a file iv. Save as a file v. Exit Performances for the file menu:- 1: create a new file To create our new file , we can do following instruction 1. On the File menu, click New. 2. In the New Document task pane, under New, click From existing document. 3. Click the document you want to create a new document from. If you want to open a document that was saved in a different folder, locate and open the folder. 4. Click Create New. This document is created in the folder that contains the original document. 2. Open a file To open a file , we can do following instruction 1. click File, and then click Open. 2. In the Look in list, click the drive, folder, or Internet location that contains the file you want to open. 3. In the folder list, locate and open the folder that contains the file. 4. Click the file, and then click Open.
  • 20. I.Save a file • On the File menu, click Save. • In the File name box, enter a new name for the file. • Click Save. Saveas a file 1. On the File menu, click Save as. 2. In the File name box, enter a new name for the file. 3. Click the Save as type drop-down list, and then click the file format that you want the file saved in. The out put for edit menu  The edit menu is also perform the following Idem There are:- i. Cut ii. Copy iii. Paste
  • 21. II. Copy a file 1. On the Standard toolbar, click Open . 2. Click a shortcut on the Places Bar, or in the Look in box, click the drive or folder that contains the file you want to copy. 3. In the folder list, locate and open the folder that contains the file you want to copy. 4. Right-click the file you want to copy, and then click Copy on the shortcut menu. 5. In the Look in box, click the drive or folder you want to copy the file to. 6. In the folder list, locate and open the folder you want to copy the file to. 7. Right-click anywhere in the folder list (make sure your pointer is not resting over a file in the list), and then click Paste on the shortcut menu. III.Cut and Paste a file 1. On the Standard toolbar, click Open . 2. Click a shortcut on the Places Bar, or in the Look in box, click the drive or folder that contains the file you want to move. 3. In the folder list, locate and open the folder that contains the file you want to move. 4. Right-click the file you want to move, and then click Cut on the shortcut menu. 5. In the Look in box, click the drive or folder you want to move the file to. 6. In the folder list, locate and open the folder you want to move the file to. 7. Right-click anywhere in the folder list (make sure your pointer is not resting over a file in the list), and then click Paste on the shortcut menu. The output for syntaxhighlighting IF WE WANT THE OUTPUT FOR syntaxhighlighting WE FOLLOW THE FOLLOWING COMMANDS:- AT FIRST WE TYPE THE WORD ,FOR EXAMPLE WE WANT THE SYNTAX FOR ‘if’  Type the if in text area  Then pressed the spaces bar  Then syntax can be apper in the syntaxhighligthing text.
  • 22. The out put for system Procedure for compilation :-  First write a program.  Then click systemcompile.  The Task Manager Dialog box can be opened.  Then click filecompile.
  • 23.  Task Manager dialog box can be apper.  Then go to file menu in the Task Manager.
  • 24.  Select NEW TASK(RUN…) ,then Run dialog box can be apper.  Enter “cmd” and click ok button.
  • 25.  Know we can run it.  Thus we execute the program.