Вы находитесь на странице: 1из 33

1)

Introduction:-

Objective:JEdit is a java based application in which the java developer can create, save and open his java files. Besides of it the users (java developer) can compile & execute their java application programs. The user has not required opening the CMD (command prompt) to compile &see the output of the java program. There is a facility in the editor to see the output in the current screen. In case of error the user can see the errors in the error pane. The user can pass the arguments in his program dynamically. The user can save the file according to his requirements.

Scope:-

This project has been basically developed for the java application programs. We can create & save the java files. But we can not create the servlet or JSP programs by using this application. We are not able to add the server in our application. To use this application the user must has the knowledge of the JAVA language. He should know the commands for the compile and execute the java file.

2)Process description:The process description of our project is as follows:


1

Class Diagram:The class diagram shows the relations between the various classes. It also shows the data members & method of every class.

DFD of the project:The DFD of the project shows the flow the information. Briefly it shows the internal process of the project.

3)Modular Description:In programming, modular design or "modularity in design" is an approach that subdivides a program into smaller parts (modules) that can be independently created and then used in different functions to drive multiple functionalities. In our project, we had used many objects to create modules. The small description about each are given below... File Although most of the classes defined by java.io operate on streams, the File class does not. It deals directly with files and the file system. That is, the File class does not specify how information is retrieved from or stored in files; it describes the properties of a file itself. A File object is used to obtain or manipulate the information associated with a disk file, such as the permissions, time, date, and directory path, and to navigate subdirectory hierarchies. Files are a primary source and destination for data within many programs. Although there are severe restrictions on their use within applets for security reasons, files are still a central resource for storing persistent and shared information. Swing Fundamental to Swing is the JApplet class, which extends Applet. Applets that use Swing must be subclasses of JApplet. JApplet is rich with functionality that is not found in Applet. For example, JApplet supports various "panes," such as the content pane, the glass pane, and the root pane. For the examples in this chapter, we will not be using most of JApplet's enhanced features. However, one difference between Applet and JApplet is important to this discussion, because it is used by the many applets. When adding a component to an instance of JApplet, do not invoke the add( ) method of the applet. Instead, call add( ) for the content pane of the JApplet object. The content pane can be obtained via the method shown here: Container getContentPane( )

The add( ) method of Container can be used to add a component to a content pane. Its form is shown here: void add(comp) Here, comp is the component to be added to the content pane. TextFields The Swing text field is encapsulated by the JTextComponent class, which extends JComponent. It provides functionality that is common to Swing text components. One of its subclasses is JTextField, which allows you to edit one line of text. Panes Used In The Project:: JRootPane The JRootPane class acts as a container delegate for the top-level Swing containers. Because the container holds only a JRootPane when you add or remove components from a top-level container, instead of directly altering the components in the container, you indirectly add or remove components from its JRootPane instance. In effect, the top-level containers are acting as proxies, with the JRootPane doing all the work.The JRootPane container relies on its inner class RootLayout for layout management and takes up all the space of the top-level container that holds it. There are only two components within a JRootPane: a JLayeredPane and a glass pane (Component). The glass pane is in front, can be any component, and tends to be invisible. The glass pane ensures that elements such astooltip text appear in front of any other Swing components. In the back is the JLayeredPane,which contains an optional JMenuBar on top and a content pane (Container) below it in another layer. It is within the content pane that you would normally place components in the JRootPane.

JLayeredPane The JLayeredPane serves as the main component container of a JRootPane. The JLayeredPanemanages the z-order, or layering, of components within itself. This ensures that the correct component is drawn on top of other components for tasks such as creating tooltip text, pop-up menus, and dragging for drag-and-drop. You can use the system-defined layers, or you can create your own layers.Although initially a JLayeredPane container has no layout manager, theres nothing to stop you from setting the layout property of the container, defeating the layering aspect of the container.

JDesktopPane Another class for working with groups of internal frames is the JDesktopPane class. The sole purpose of the desktop pane is to contain a set of internal frames. When internal frames are contained within a desktop pane, they delegate most of their behavior to the desktop manager of the desktop pane. JOptionPane JOptionPane is a special class for creating a panel to be placed in a pop-up window. The purpose of the panel is to display a message to a user and get a response from that user.To accomplish its task, the panel presents content in four areas . Icon: The icon area is for the display of an Icon to indicate the type of message being displayed to the user. Its the responsibility of the installed look and feel to provide default icons for certain types of messages, but you can provide your own if you need to display another icon type. Message: The primary purpose of this area is to display a text message. In addition, the area can contain any optional set of objects to make the message more informational. Input: The input area allows a user to provide a response to a message. The response can be free form, in a text field, or from a pick list in a combo box or list control. For yes or no type questions, the button area should be used instead. Button: The button area is also for getting user input. Selection of a button in this area signals the end of the usage of the JOptionPane. Default sets of button labels are available, or you can display any number of buttons, including none, with any labels you desire.

JEditorPane The JEditorPane class provides the ability to display and edit multiple-attributed text. While the JTextField and JTextArea support only single-color, single-font content, the JEditorPaneallows you to tag your content with various styles (such as bold, italics, 14-point Helvetica, right-justified paragraphs) or with the appearance of an HTML viewer, as shown in Figure

JSplitPane

Similar to the Box container, the JSplitPane container allows you to display components in a single row or column. Whereas a Box can contain any number of components, a JSplitPane is meant to display twoand only twocomponents. The components are of variable size and separated by a movable divider. The divider is specially constructed in that the end user can grab it and drag the divider to adjust the size of the contained components. Figure demonstrates both vertical and horizontal split panes, shown before and after moving the divider.

JTextPane The JTextPane is a specialized form of the JEditorPane designed especially for the editing (and display) of styled text. It differs from the JEditorPane only in its manner of providing the content to display because the text isnt tagged with the styles as it would be in an HTML or RTF document. The JTextPane relies on three interfaces for the setting of text attributes: AttributeSet for a basic collection of attributes, MutableAttributeSet for a changeable collection of attributes, and Style for a set of attributes to be associated with a part of a StyledDocument.

JTabbedPane The JTabbedPane class represents the ever-popular property sheet to support input or output from multiple panels within a single window in which only one panel is shown at a time. Using JTabbedPane is like using the CardLayout manager, except with added support for changing cards built in. While CardLayout is a LayoutManager, JTabbedPane is a full-fledged Container. In case youre not familiar with property sheets, tabbed dialog boxes, or tabbed panes (all alternate names for the same thing), Figure shows a set of tabs from the original SwingSet demo that comes with the JDK 1.2 version of the Swing classes.

JScrollPane
10

Swings JScrollPane container provides for the display of a large component within a smaller display area, with scrolling support (if necessary) to get to the parts currently invisible. Figure shows one such implementation, in which the large component is a JLabel with an ImageIconon it.

4)Requirement Specifications:Technologies: JRE and JDK: Sun Microsystems provides two principal software products in the JavaTM 2 Platform Standard Edition (J2SETM) family: J2SE Runtime Environment (JRE): The JRE provides the libraries, Java virtual machine, and other components necessary for you to run applets and applications written in the Java programming language. This runtime environment can be redistributed with applications to make them free-standing. J2SE Development Kit (JDK):

11

The JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications. Java Programming Language: The Java Programming Language is a general-purpose, concurrent, strongly typed,class-based object-oriented language. It is normally compiled to the bytecode instruction set and binary format defined in the Java Virtual Machine Specification.

Java Virtual Machines: The Java virtual machine is an abstract computing machine that has an instruction set and manipulates memory at run time. The Java virtual machine is ported to different platforms to provide hardware- and operating system-independence. The Java 2 Platform Standard Edition provides two implementations of the Java virtual machine (VM):

Base Libraries: Classes and interfaces that provide basic features and fundamental functionality for the Java platform. Lang and Util Packages: Provides the fundamental Object and Class classes, wrapper classes for primitive types, a basic math class, and more. javax.swing Package: Provide the object and classes for developing interactive GUI

12

Other Base Packages: I/O: I/O functionality provides for system input and output through data streams, serialization and the file system. In 1.4, a new I/O (NIO) API was introduced that provides new features and improved performance.

User Interface Libraries: AWT: The JavaTM platform's Abstract Windowing Toolkit (AWT) provides APIs for constructing user interface components such as menus, buttons, text fields, dialog boxes, checkboxes, and for handling user input through those components. In addition, AWT allows for rendering of simple shapes such as ovals and polygons and enables developers to control the user-interface layout and fonts used by their applications.. Swing: The Swing APIs also provide graphical component (GUI) for use in user interfaces. The Swing APIs are written in the Java programming language without any reliance on code that is specific to the GUI facilities provided by underlying operating system. This allows the Swing GUI components to have a "pluggable" look-and-feel that can be switched while an application is running.

Tool Specifications: Debugger Architecture: Architecture and specifications for use by debuggers in development environments.

VM Tool Interface:
13

The Java Virtual Machine Tool Interface (JVM TI) is a specification for inspecting the state and controlling the execution of applications running in the JVM. The Java Virtual Machine Profiler Interface (JVMPI) has been deprecated.. Javadoc Tool: Javadoc is a tool that parses the declarations and documentation comments source files to produce a set of HTML pages describing the program elements. The Doclet API provides a mechanism for clients to inspect the source-level structure of programs and libraries, including javadoc comments embedded in the source. This API can be used by doclets to generate documentation. JDK Tools & Utilities: Documentation for the tools and utilities included in the JDK. Covers basic tools (javac , java, javadoc , apt, appletviewer, jar, jdb, javah, javap, extcheck) and security tools. Platforms: Sun provides implementations of the JDK and Java Runtime Environment for Microsoft Windows, Linux, and the Solaris operating systems.

Hardware and Software specification: Hardware Processor RAM Pentium II (32 or 64 64 MB bit)at 233 MHz or Celeron 2.4 GHz Language Runtime Environment JAVA Jre 1.4 and above JAVA Swing Disk Space 1 GB Tools Javac, java, jar, javap

Software

User interface

Limitations:
14

Not capable to run web projects (Servlets, JSPs, EJBs etc.). Users have to compile and run project manually . IDE will not be doing it automatically as a backend process. Testing and debugging features are not available. Help window not provide. Support application developed in java not any other language. To run this application jvm must be installed on your system.

5) Coding
Editor Class: import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Editor implements ActionListener{ JFrame f; JLabel l; JTextField tf; JTextArea ta; JScrollPane js; JButton b,b1; public Editor() { f=new JFrame("MyEditor"); l=new JLabel("enter java prog"); l.setBounds(50,50,100,25); tf=new JTextField(100); tf.setBounds(160,50,150,25); b=new JButton("Compile"); b1=new JButton("Run"); b.setBounds(50,320,80,30);
15

b1.setBounds(350,320,80,30); ta=new JTextArea(250,60); js=new JScrollPane(ta,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAY S,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); js.setBounds(20,100,450,200); Container c=f.getContentPane(); c.add(l); c.add(tf); c.add(js); c.add(b); c.add(b1); c.setLayout(null); f.setSize(500,400); f.setVisible(true); b.addActionListener(this); b1.addActionListener(this); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); String fname=tf.getText(); String s=""; InputStream bf,bf1; DataInputStream di,di1; try { Runtime r=Runtime.getRuntime(); if(str.equals("Compile")) { String name="javac "+fname+".java"; Process p=r.exec(name); bf=p.getErrorStream(); di=new DataInputStream(bf); s=di.readLine(); if(s==null) ta.setText("Compilation Successful"); else { ta.setText(s); while(s!=null) {
16

s=di.readLine(); if(s!=null) ta.append("\n"+s);} } } else { String name="java "+fname; Process p=r.exec(name); bf=p.getErrorStream(); di=new DataInputStream(bf); s=di.readLine(); if(s!=null) {ta.setText(s); while(s!=null) { s=di.readLine(); if(s!=null) ta.append("\n"+s);} } else { bf1=p.getInputStream(); di1=new DataInputStream(bf1); String stt=di1.readLine(); ta.setText(stt); while(stt!=null) { stt=di1.readLine(); if(stt!=null) ta.append(stt+"/n"); } } } } catch(Exception e){} } public static void main(String args[]) { new Editor();
17

} } IDE Class: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import javax.swing.filechooser.*; public class IDE implements ActionListener { JFrame jf; JTextPane jp1,jp2,jp3,jp4,jp5; JTabbedPane jt1,jt2,jt3; JScrollPane js1,js2,js3; JSplitPane jsp1,jsp2,jsp3; JMenuBar m; JMenu m1,m2; JMenuItem im1,im2,im3,im4,im5,im21,im22; JFileChooser jfc; File f; String fn,s1,a; int i,j; public IDE() { jf=new JFrame("DEVELOPMENT ENVIORNMENT"); jfc=new JFileChooser("E:"); Container c=jf.getContentPane(); jf.setLayout(null); Font f1=new Font("serif",Font.PLAIN,20); Font f2=new Font("arial",Font.PLAIN,16); Font f3=new Font("calibri",Font.PLAIN,16); Font f4=new Font("calibri",Font.PLAIN,16); Font f5=new Font("calibri",Font.PLAIN,16); m=new JMenuBar(); m1=new JMenu("File"); m2=new JMenu("Build"); im1=new JMenuItem("New");
18

im2=new JMenuItem("Open"); im3=new JMenuItem("Save"); im4=new JMenuItem("Save As"); im5=new JMenuItem("Exit"); m1.add(im1); m1.add(im2); m1.add(im3); m1.add(im4); m1.add(im5); im1.addActionListener(this); im2.addActionListener(this); im3.addActionListener(this); im4.addActionListener(this); im5.addActionListener(this); im21=new JMenuItem("Compile"); im22=new JMenuItem("Run"); m2.add(im21); m2.add(im22); m.add(m1); m.add(m2); jf.setJMenuBar(m); im21.addActionListener(this); im22.addActionListener(this); jp1=new JTextPane(); jp2=new JTextPane(); jp3=new JTextPane(); jp4=new JTextPane(); jp5=new JTextPane(); jp1.setFont(f1); jp1.setForeground(Color.blue); jp2.setFont(f2); jp2.setForeground(Color.red); jp3.setFont(f3); jp3.setForeground(Color.red); jp4.setFont(f4); jp4.setForeground(Color.green); jp5.setFont(f5); jp5.setForeground(Color.magenta); jp2.setEditable(false);
19

jp3.setEditable(false); jp4.setEditable(false); jp5.setEditable(false); jt1=new JTabbedPane(); jt2=new JTabbedPane(); jt3=new JTabbedPane(); jt1.addTab("File",jp1); jt2.addTab("Console",jp2); jt2.addTab("Error",jp3); jt2.addTab("Arguements",jp4); jt3.addTab("Explorer",jp5); js1=new JScrollPane(jt1); js2=new JScrollPane(jt2); js3=new JScrollPane(jt3); jsp1=new JSplitPane(JSplitPane.VERTICAL_SPLIT,js1,js2); jsp2=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,js3,jsp1); jsp1.setDividerLocation(500); jsp2.setDividerLocation(200); jsp2.setBounds(0,0,1350,670); c.add(jsp2); jf.setSize(1400,750); jf.setVisible(true); jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } public static void main(String a[]) { IDE i=new IDE(); } public void actionPerformed(ActionEvent e) { String label=e.getActionCommand(); if(label.equals("New")) now(); else if(label.equals("Open")) open();
20

else if(label.equals("Save")) save(); else if(label.equals("Save As")) saveAs(); else if(label.equals("Exit")) System.exit(0); else if(label.equals("Run")) run(); else compile(); } public void open() { int r1=jfc.showOpenDialog(jf); if(r1==JFileChooser.APPROVE_OPTION) { f=jfc.getSelectedFile(); fn=f.getName(); Runnable r =new MyThread2(jp1,f); Thread t=new Thread(r); t.start(); } else jp2.setText(" Exception Occurs......."+"\n"+"Unable to open the Requested File "); } public void now() { } public void save() { int r1=jfc.showSaveDialog(jf); if(r1==JFileChooser.APPROVE_OPTION) { f=jfc.getSelectedFile();
21

fn=f.getName(); Runnable r=new MyThread1(jp1,f,jp2); Thread t=new Thread(r); t.start(); } else jp2.setText(" Exception Occurs......."+"\n"+"Unable to open the Requested File "); } public void saveAs() { } public void run() { try{ Runnable r5=new MyThread3(jp2,fn,f); Thread t5=new Thread(r5); t5.start(); }catch(Exception e) { jp2.setText(e.toString()); } } public void compile() { try { Runnable r6=new MyThread6(jp2,f); Thread t6=new Thread(r6); t6.start(); }catch(Exception e) { jp2.setText(e.toString()); } } } class MyThread1 implements Runnable { JTextPane jp1,jp2;
22

File f; MyThread1(JTextPane jp1,File f,JTextPane jp2) { this.jp1=jp1; this.f=f; this.jp2=jp2; } public void run() { try{ String s=jp1.getText(); FileOutputStream fout=new FileOutputStream(f.toString()); byte ch[]=s.getBytes(); for(int i=0;i<ch.length;i++) fout.write(ch[i]); fout.close(); }catch(Exception e) { jp2.setText(e.toString()); } } } class MyThread2 implements Runnable { JTextPane jp1; File f; String s,i; MyThread2(JTextPane jp1,File f) { this.jp1=jp1; this.f=f; } public void run() { try{ DataInputStream fin=new DataInputStream(new FileInputStream(f.toString()));
23

s=""; while((i=fin.readLine())!=null) { s=s+i+"\n"; } jp1.setText(s); fin.close(); }catch(Exception e) { jp1.setText(e.toString()); } } } class MyThread3 implements Runnable { JTextPane j; String s1,s2,fn; File f; int i=0; MyThread3(JTextPane j,String fn,File f) { this.j=j; this.fn=fn; this.f=f; } public void run() { try{ s1=f.toString(); for(i=0;i<=fn.length();i++) if(fn.charAt(i)=='.') break; fn=fn.substring(0,i); s1="javac "+s1; s2="java "+fn; ABC a=new ABC(s1,s2,j); a.maina(); }catch(Exception e){ j.setText(e.toString());
24

} } } class MyThread6 implements Runnable { JTextPane j; String s1; File f; MyThread6(JTextPane j,File f) { this.j=j; this.f=f; } public void run() { try{ s1=f.toString(); s1="javac "+s1; AA aa=new AA(s1,j); aa.sun(); }catch(Exception e){ j.setText(e.toString()); } } } AA class: import javax.swing.*; import java.io.*; public class AA { String s1; JTextPane j; public AA(String s1,JTextPane j) { this.s1=s1; this.j=j; } public void sun() throws IOException
25

{ Runtime r=Runtime.getRuntime(); Process p=r.exec(s1); BB b=new BB(j,p); b.yield(); } } BB Class: import javax.swing.*; import java.io.*; public class BB { JTextPane jp; Process p; DataInputStream din; String s,a; public BB(JTextPane jp,Process p) { this.jp=jp; this.p=p; } void yield() throws IOException { din=new DataInputStream(p.getErrorStream()); s=din.readLine(); if(s!=null) { s=s+"\n"; while((a=din.readLine())!=null) s=s+a+"\n"; } else { s="Compilation Successful \n\n"; } jp.setText(s); } } ABC Class:

26

import javax.swing.*; import java.io.*; public class ABC { Process p,p1; String s1,s2; JTextPane j; public ABC(String s1,String s2,JTextPane j) { this.s1=s1; this.s2=s2; this.j=j; } public void maina() throws IOException { p1=Runtime.getRuntime().exec(s1); p=Runtime.getRuntime().exec(s2); BCD b=new BCD(j,p); b.play(); } } BCD Class: import javax.swing.*; import java.io.*; public class BCD { JTextPane jp; Process p; DataInputStream din; String s,a; public BCD(JTextPane jp,Process p) { this.jp=jp; this.p=p; } void play() throws IOException {
27

din=new DataInputStream(p.getErrorStream()); s=din.readLine(); if(s!=null) { s=s+"\n"; while((a=din.readLine())!=null) s=s+a+"\n"; } else { s=""; din=new DataInputStream(p.getInputStream()); while((a=din.readLine())!=null) s=s+a+"\n"; } jp.setText(s);}}

6) Testing & Debugging


Software testing is the process of executing a program with intension of finding errors in the code. It is a process of evolution of system or its parts by manual or automatic means to verify that it is satisfying specified or requirements or not. Generally, no system is perfect due to communication problems between user and developer, time constraints, or conceptual mistakes by developer. To purpose of system testing is to check and find out these errors or faults as early as possible so losses due to it can be saved. Testing is the fundamental process of software success. Testing is not a distinct phase in system development life cycle but should be applicable throughout all phases i.e. design development and maintenance phase.
28

Testing is used to show incorrectness and considered to success when an error is detected.

OBJECTIVES OF SOFTWARE TESTING:


The software testing is usually performed for the following objectives:-

SOFTWARE QUALITY IMPROVEMENT:- The computer and the software are mainly used for complex and critical applications and a bug or fault in software causes severe losses. So a great consideration is required for checking for quality of software. VERIFICATION AND VALIDATION: Verification means to test that we are building the product in right way .i.e. are we using the correct procedure for the development of software so that it can meet the user requirements.

Validation means to check whether we are building the right product or not. SOFTWARE RELIABILTY ESTIMATION:- The objective is to discover the residual designing errors before delivery to the customer. The failure data during process are taken down in order to estimate the software reliability.

PRINCIPLES OF SOFTWARE TESTING


Software testing is an extremely creative and challenging task. Some important principles of software testing are as given:29

All tests should be traceable to customer requirements. Testing time and resources should be limited i.e. avoid redundant testing. It is impossible to test everything. Use effective resources to test. Test should be planned long before testing begins i.e. after requirement phase. Test for invalid and unexpected input conditions as well as valid conditions. Testing should begin in in the small and progress towards testing in the large. For the most effective testing should be conducted by an independent party. Keep software static (without change mean while) during test. Document test cases and test results. Examining what the software not doing which it expected to do and also checking what it is doing that was not expected to do.

STRATEGY FOR SOFTWARE TESTING

30

Different levels of testing are used in the test process; each level of testing aims to test different aspects of the system. The first level is unit testing. In this testing, individual components are tested to ensure that they operate correctly. It focuses on verification efforts. The second level is integration testing. It is a systematic technique for constructing the program structure. In this testing, many tested modules are combined into the subsystem which are then tested. The good here is to see if the modules can be integrated properly. Third level is integration testing. System testing is actually a series of different tests whose primary purpose is to fully exercise computer based system. These tests fall outside scope of software process and are not conducted solely by software engineers.

7) Conclusion:Though the system still containing lot of scope of improvement in it. But its overall look and feel gives rough picture of on existing automation system. There is no bach end in the project. There is no process in the project in the which is going on at backend like other java editors.

31

32

33

Вам также может понравиться