# /*Program for Rational numbers @Author III CSE @Version 1.0 */ import java.io.*; import java.util.

*; class Rational { int n,d; /* This constructor to get Numerator and Denominator value*/ Rational(int x,int y) { n=x; d=y; System.out.println("NUMERATOR="+n); System.out.println("DENOMINATOR="+d); System.out.println("BEFORE SIMPLIFICATION="+n+"/"+d); } /* This method finds the reduce form of Numerator and Denominator value*/ public void reducedform() { if(n<d) { for(int i=2;i<=n;i++) { while((n%i)==0 && (d%i)==0) { n=n/i; d=d/i; } } } else { for(int i=2;i<=d;i++) { while((n%i)==0 && (d%i)==0) { n=n/i; d=d/i; } } } }

void display() { System.out.println("Reduced form="+n+"/"+d); } public static void main(String args[]) { Scanner S=new Scanner(System.in); System.out.println("******ENTER NUMERATOR VALUE******"); int A=S.nextInt(); System.out.println("******ENTER DENOMINATOR VALUE******"); int B=S.nextInt(); Rational R=new Rational(A,B); R.reducedform(); R.display(); } }

OUTPUT: D:\Java\jdk1.5.0_03\bin>javac Rational.java D:\ Java\jdk1.5.0_03\bin>java Rational ******ENTER NUMERATOR VALUE****** 50 ******ENTER DENOMINATOR VALUE****** 100 NUMERATOR=50 DENOMINATOR=100 BEFORE SIMPLIFICATION=50/100 Reduced form=1/2 D:\ Java\jdk1.5.0_03\bin>java Rational ******ENTER NUMERATOR VALUE****** 60 ******ENTER DENOMINATOR VALUE****** 20 NUMERATOR=60 DENOMINATOR=20 BEFORE SIMPLIFICATION=60/20 Reduced form=3/1 D:\ Java\jdk1.5.0_03\bin>

/*Program for user defined package-date class @Author III CSE @Version 1.0 */ package Date; import java.util.GregorianCalendar; public class CurrentDate { public void MDY() { GregorianCalendar cal = new GregorianCalendar(); int month = cal.get(GregorianCalendar.MONTH); int year = cal.get(GregorianCalendar.YEAR); int day = cal.get(GregorianCalendar.DAY_OF_MONTH); System.out.println("Current date : " + day + "/" + (month + 1) + "/" + year); } public void HMS() { GregorianCalendar cal = new GregorianCalendar(); String am_pm; int hour = cal.get(GregorianCalendar.HOUR); int minute = cal.get(GregorianCalendar.MINUTE); int second = cal.get(GregorianCalendar.SECOND); if(cal.get(GregorianCalendar.AM_PM) == 0) am_pm = "PM"; else am_pm = "AM"; System.out.println("Current Time : " + hour + ":" + minute + ":" + second + " " + am_pm); } } /***Application Program with imported User Defined Package***/ import Date.*; class DISPLAY { public static void main(String args[]) { CurrentDate D=new CurrentDate(); System.out.println("**************"); D.MDY(); System.out.println("**************"); D.HMS(); } }

OUTPUT:

D:\Java\jdk1.5.0_03\bin>cd Date D:\ Java\jdk1.5.0_03\bin\Date>set path=” D:\Java\jdk1.5.0_03\bin” D:\ Java\jdk1.5.0_03\bin\Date>javac CurrentDate.java D:\ Java\jdk1.5.0_03\bin\Date>cd.. D:\ Java\jdk1.5.0_03\bin>javac DISPLAY.java D:\ Java\jdk1.5.0_03\bin>java DISPLAY ************** Current date : 08/10/2010 ************** Current Time : 07:10:27 AM D:\ Java\jdk1.5.0_03\bin>

System.System. System.out.out.println("Enter two integers to concatenate into a lisp list").out. } } .CONS(read.println("result of car operation in Lisp list"+lisp. lisp.out.out.nextInt()).println("Elements in the lisp list"+lisp.CDR()). System.println("Enter a string to concatenate into a lisp list"). System.println("result of car operation in Lisp list"+lisp. lisp. System. lisp.next()).nextInt()).getSize()).out.getList()).CONS(read.println("size of the lisp list"+lisp.CAR()).CONS(read.

java D:\ Java\jdk1.0_03\bin>java LispListTest Enter three integer elements to store in LinkedList 12 28 34 Enter two integers to concatenate into a lisp list 98 21 Enter a string to concatenate into a lisp list java Elements in the lisp list [java 21 98[34 28 12]] size of the lisp list 4 result of car operation in Lisp list java result of car operation in Lisp list [21 98[34 28 12]] D:\ Java\jdk1.0_03\bin> .0_03\bin>javac LispListTest.5.5.5.OUTPUT: D:\Java\jdk1.

lang.util. System. } public void pop() { list. System.*. import java. n++.remove(--n).*. System. } } class arraylist implements stackDemo { static int n=0. System. ArrayList list = new ArrayList(). } } . } class linkedlist implements stackDemo { LinkedList list = new LinkedList(). public void pop(). public void push(int v) { list.out.out. } public void pop() { list.println(list).addFirst(v).println(list).removeFirst().println(list). interface stackDemo { public void push(int v).out.println(list).add(v). public void push(int v) { list.out./**************PROGRAM FOR ADT STACK INTERFACE****************/ import java.

pop(). } break. Scanner S=new Scanner(System. System.print("Enter elements : ").STACK IMPLEMENTATION USING LINKED LIST"). } }while(lk<=2).println("1.out. System. switch(ch) { case 1: System.nextInt().out. System. L. case 2: try { L. break.println("ENTER YOUR CHOICE 1.nextInt().out.out.STACK IMPLEMENTATION USING ARRAY").out. System.println("EMPTY STACK:"+k).println("2.out.println("ENTER YOUR CHOICE"). System. .in).println(L). ch=S. switch(lk) { case 1: System.println("STACK IMPLEMENTATION USING ARRAY AND LINKED LIST").out.PUSH 2.class stackall { public static void main(String args[]) { int ch.in).ak. default: System.POP"). linkedlist L= new linkedlist(). Scanner T=new Scanner(System.lk.println("INVALID CHOICE"). do { System. lk=T.out.println("1. int n = T.push(n). break. } catch(NoSuchElementException k) { System.nextInt().out.STACK IMPLEMENTATION USING LINKED LIST").out.

out. int u = x.println("1. break.push(u). } }while(ak<=2). default: System. break.println("INVALID CHOICE").PUSH 2.println("ENTER YOUR CHOICE 1.out.out.out. case 2: try { A.STACK IMPLEMENTATION USING Array"). do { System. } } } . A. } break.out.out.nextInt(). arraylist A= new arraylist().nextInt().POP"). Scanner x=new Scanner(System.println("INVALID CHOICE").in).case 2: System.pop(). break.println("EMPTY STACK:"+km). System. switch(ak) { case 1: System. default: System. ak=x.out. } catch(ArrayIndexOutOfBoundsException km) { System.println(A).print("Enter elements : ").

PUSH 2.0_03\bin> .PUSH 2.5.PUSH 2. 66] ENTER YOUR CHOICE 1.POP 9 INVALID CHOICE INVALID CHOICE D:\ Java\jdk1.POP 2 [] ENTER YOUR CHOICE 1.POP 2 EMPTY STACK:java.lang.[90.PUSH 2.ArrayIndexOutOfBoundsException: -1 ENTER YOUR CHOICE 1.POP 2 [90] ENTER YOUR CHOICE 1.

System.io.println("NAME:"+name). this.out. this.println("NAME:"+name). System. System.out.weight=weight.double weight. } .out.*.println("NO.wheels=wheels.println("*********CAR DETAILS*********").double weight.out.out. System.println("NO.OF WHEELS:"+wheels).OF WHEELS:"+wheels).name=name.println("WEIGHT:"+weight). System./****************PROGRAM FOR INHERITANCE AND POLYMORPHISM***********/ import java. this. System.out.out. abstract void display(). } } class Trucks extends vehicle { public Trucks(String name.out.out. System.int wheels) { this.println("*********TRUCKS DETAILS*********").name=name.out.println("WEIGHT:"+weight).util.int wheels) { this. this. } class car extends vehicle { public car(String name.*.wheels=wheels. System.println("WEIGHT:"+weight).out.out.weight=weight.OF WHEELS:"+wheels).out. } public void display() { System.println("WEIGHT:"+weight).OF WHEELS:"+wheels).println("NAME:"+name). System. int wheels. abstract class vehicle { String name.out. System.println("NO. } public void display() { System. import java.println("NO. double weight.println("NAME:"+name). System. System.

out.display(). } } . System.println("***********CAR**********").v.out.OF WHEELS IN CAR**********").next(). System.println("***********ENTER CAR WEIGHT**********"). car C=new car(x.y. int z=S. System. int w=S. C.in).out. double y=S. String x=S.z).} class hierarchy { public static void main(String arg[]) { Scanner S=new Scanner(System. T.nextDouble().display().println("***********ENTER NO.OF WHEELS IN TRUCKS **********"). System. System. Double v=S.nextDouble().println("***********ENTER NO.nextInt(). Trucks T=new Trucks(u.out. System.nextInt().println("***********ENTER TRUCKS NAME**********"). String u=S.out.next().out.println("***********ENTER CAR NAME**********").w).println("***********ENTER TRUCKS WEIGHT**********").out. System.

OUTPUT: D:\Java\jdk1.OF WHEELS:4 NAME:mahindra WEIGHT:50000.OF WHEELS:4 D:\ Java\jdk1.OF WHEELS IN TRUCKS ********** 4 NAME:BENZ WEIGHT:10000.0 NO.5.0 NO.0 NO.OF WHEELS:4 *********CAR DETAILS********* NAME:BENZ WEIGHT:10000.5.0_03\bin> .0 NO.OF WHEELS:4 *********TRUCKS DETAILS********* NAME:mahindra WEIGHT:50000.OF WHEELS IN CAR********** 4 ***********ENTER TRUCKS NAME********** mahindra ***********ENTER TRUCKS WEIGHT********** 50000 ***********ENTER NO.5.0_03\bin>javac hierarchy.java D:\ Java\jdk1.0_03\bin>java hierarchy ***********CAR********** ***********ENTER CAR NAME********** BENZ ***********ENTER CAR WEIGHT********** 10000 ***********ENTER NO.

amount = amt. FileOutputStream fos = new FileOutputStream("serial.util. try { Currency currency.txt").amt). } } class Rupee extends Currency { public Rupee(int amt) { super("Rs".currency = cur. } } public class SerializationWrite { public static void main(String args[]) { Random r = new Random(). protected int amount.java********************************/ import java. . } public String toString() { return currency + amount.*./*****************PROGRAM FOR SERIALIZATION ********************/ /*****************SerializationWrite. this. int amt) { this.*. class Currency implements Serializable { protected String currency. ObjectOutputStream oos = new ObjectOutputStream(fos). } public String dollarToRupee(int amt) { return "Rs" + amt * 45. import java. public Currency(String cur.amt).io. } } class Dollar extends Currency { public Dollar(int amt) { super("\$".

ObjectInputStream ois = new ObjectInputStream(fis).util.nextInt(2)]. if((obj.println(currency).java**********************************/ import java. } catch(Exception e) { System.nextInt(200)) }.println("Reading from file using Object Serialization:").*.i<=10.println("Exception during deserialization. } } } /********************** SerializationRead.out. } catch(Exception e) { System.println("Writing to file using Object Serialization:"). } oos.out. System.io.nextInt(200)).println("Exception during Serialization: " + e).println(obj + " = " + obj.out. } ois. // RANDOM Objects for Rs and \$ System.i++) { obj = (Currency)ois.close().close().out. oos. for(int i=1.out.amount)). import java. FileInputStream fis = new FileInputStream("serial.equals("\$")) System. for(int i=1.dollarToRupee(obj. public class SerializationRead { public static void main(String args[]) { try { Currency obj. currency = (Currency)obj[r. } } } .*.i++) { Object[] obj = { new Rupee(r.i<=10.out.currency). oos.new Dollar(r.readObject().writeObject(currency).out." + e).println(obj + " = " + obj).flush().txt"). else System.System.

.5. Reading from file using Object Serialization: Rs65 = Rs65 \$173 = Rs7785 Rs30 = Rs30 \$73 = Rs3285 \$48 = Rs2160 Rs180 = Rs180 \$65 = Rs2925 Rs39 = Rs39 \$32 = Rs1440 \$44 = Rs1980 D:\ Java\jdk1.java D:\ Java\jdk1.java D:\ Java\jdk1.0_03\bin>java SerializationWrite Writing to file using Object Serialization: Rs65 \$173 Rs30 \$73 \$48 Rs180 \$65 Rs39 \$32 \$44 D:\Java\jdk1.5.0_03\bin>javac SerializationWrite.5.0_03\bin>java SerializationRead.OUTPUT: D:\Java\jdk1.0_03\bin> .5.0_03\bin>javac SerializationRead.5.

equals("cos")) result=Math.setText(" ").sqrt(x).getActionCommand().toRadians(x)).equals("sqrt")) result=Math.equals("-")) { display. else if(lastcommand.equals("=")) result=x.toRadians(x)).setText(" "+result).setText(command).cos(Math.tan(Math. start=false. if(start) { if(command. } } class commandAction implements ActionListener { public void actionPerformed(ActionEvent e) { String command=e. else if(lastcommand. } display.parseDouble(display.equals("sin")) result=Math.result*=x. lastcommand=command. } class insertAction implements ActionListener { public void actionPerformed(ActionEvent e) { String input=e.equals("tan")) result=Math. else if(lastcommand.equals("/")) result/=x. start=true. else if(lastcommand. } else { calculate(Double.getActionCommand().toRadians(x)).sin(Math.getText()+input).getText())). else if(lastcommand. if(start) { display. else if(lastcommand. start=false. } else lastcommand=command. display. .setText(display.

} } class calci { public static void main(String args[]) { calculatorframe cf=new calculatorframe(). cf. Toolkit kit=Toolkit.setVisible(true). setIconImage(im).getImage("U:\\calicon. Image im=kit.setDefaultCloseOperation(JFrame. calculatorpanel panel=new calculatorpanel(). } } .getDefaultToolkit().EXIT_ON_CLOSE).jpg").250). setLocationByPlatform(true). add(panel).} } } } class calculatorframe extends JFrame { public calculatorframe() { setSize(350. cf. setTitle("Calculator").

5.OUTPUT: D:\ Java\jdk1.java D:\ Java\jdk1.0_03\bin>java calci .5.0_03\bin>javac calci.

sleep(100). class Fibonacci extends Thread { private PipedWriter out = new PipedWriter(). t.println("Fibonacci:"+e). if(fibo>100000) { out.currentThread(). } catch(Exception e) { System.getName() + " thread started"). } out. public PipedWriter getPipedWriter() { return out1.write(fibo). public PipedWriter getPipedWriter() { return out.out. } . fibo2=fibo.out.*.println(t. } public void run() { Thread t = Thread. import java. System. } } class Prime extends Thread { private PipedWriter out1 = new PipedWriter().fibo=0.getName() + " thread exiting"). } fibo1=fibo2. break.util.io.out.*. } System. int fibo1=0.close(). while(true) { try { fibo = fibo1 + fibo2.println(t./*******PROGRAM FOR MULTITHREADED--PRIME AND FIBONACCI NUMBER********/ import java.setName("Fibonacci").fibo2=1.

. D:\ Java\jdk1..0_03\bin>javac PipedIo.OUTPUT: D:\ Java\jdk1.5.5. The numbers common to PRIME and FIBONACCI: 1 2 3 5 13 89 233 1597 Fibonacci thread exiting 28657 Main thread exiting Prime thread exiting. Fibonacci thread started Prime thread Started.0_03\bin> ..0_03\bin>java PipedIo Main thread Started.5.java D:\ Java\jdk1..

add(p). next.getConnection("jdbc:odbc:custo").*.CENTER)).addActionListener(this). try { Class. // Customers is the table name res.CENTER)). static Statement stat.awt.odbc. } public static void main(String args[]) { Datas d = new Datas().JLabel. next = new JButton("Next BOOK"). c.add(new JLabel("ISBN".setLayout(new GridLayout(5. pack().jdbc. name = new JTextField(20). c. c.*. import javax.event.add(name). import java. conn = DriverManager. p. // custo is the DSN Name stat = conn.add(id). public Datas() { super("Our Application"). JButton next. addWindowListener(new WIN()).swing. } catch(Exception e) . JTextField name. res = stat./*****************PROGRAM FOR SIMPLE OPAC SYSTEM FORLIBRARY*******************/ EVENT DRIVEN import java.next().awt. c. JPanel p.JLabel.1)).forName("sun. c. static ResultSet res. id = new JTextField(20).sql. p = new JPanel().createStatement(). import java.*. public class Datas extends JFrame implements ActionListener { JTextField id.executeQuery("Select * from Customers").add(next). JButton addnew. static Connection conn.add(new JLabel("Book Name". c. setVisible(true). Container c = getContentPane().JdbcOdbcDriver").*.

getString(2)).println("Error" +e).showRecord(res). } d. } public void actionPerformed(ActionEvent e) { if(e.getSource() == next) { try { res.setText(res."Database".QUESTION_MESSAGE).getString(1)). } } public void showRecord(ResultSet res) { try { id. } } //end of WIN class }//end of Datas class .JOptionPane. name.setText(res. } catch(Exception ee) {} showRecord(res). } catch(Exception e) {} } //Inner class WIN implemented class WIN extends WindowAdapter { public void windowClosing(WindowEvent w) { JOptionPane jop = new JOptionPane()."Thanks".next().showMessageDialog(null.out. jop.{ System.

java D:\ Java\jdk1.OUTPUT: D:\ Java\jdk1.0_03\bin>java Datas .0_03\bin>javac Datas.5.5.

Connection con.JdbcOdbcDriver").out.getInt(1).DriverManager.println("connection error").getConnection("jdbc:odbc:cust"). con=DriverManager.println("sql error"). int booksno. System.bookname. Ja() { try { Class. rs=stmt. ResultSet rs.getString(2). while(rs.out. Statement stmt. } } void myput() { try { stmt=con. import java.next()) { booksno=rs.CONCURRENT import java.println("\n"+ booksno+"\t"+bookid+"\t"+bookname).close().jdbc. con. class Ja { String bookid.createStatement().out. bookid=rs. } catch(SQLException e) { System.sql.executeQuery("SELECT * FROM cust1").forName("sun. bookname=rs.odbc.sql. } catch(Exception e) { System.close(). } } } .*.close(). } rs.getString(3). stmt.*.

5. } } OUTPUT: D:\ Java\jdk1.java D:\ Java\jdk1.5.myput().class prog1 { public static void main(String arg[]) { Ja j=new Ja(). j.0_03\bin>java prog1 1 2 3 10 20 30 JAVA C++ C# .0_03\bin>javac Ja.

thread.setText(" ").println(str). } } public void run() { try { while(true) { String str=br.start(). } } catch(Exception e) { System.out. } catch(Exception e) { System.getText(). ta. tf.println(e). pw. } } } .Thread thread=new Thread(this).println(e).readLine().out.append(str+"\n"). } public void actionPerformed(ActionEvent ae) { try { String str=tf.

import java. serverthread st=new serverthread(s). } catch(Exception ae) { System.println(e).*. public static void main(String args[]) { try { serverthreads=new Vector().start().println(ae).out.accept().addElement(st).elements().*. serverthreads.net. ServerSocket ss=new ServerSocket(4040). while(true) { Socket s=ss. } } catch(Exception e) { System.out.nextElement().hasMoreElements()) { try { serverthread st=(serverthread)e.java***********************************/ import java./*************************** chatserver .echo(str). st. st. class chatserver { static Vector serverthreads. } } } } . while(e.util. } } public synchronized static void echoAll(String str) { Enumeration e=serverthreads.

} catch(Exception e) { System.io. public serverthread(Socket socket) { try { InputStream is=socket.getOutputStream(). br=new BufferedReader(isr).*.out.echoAll(str). } catch(Exception e) { System. import java.*. chatserver. OutputStream os=socket.net.println(str).println(e).out.println(e). class serverthread extends Thread { private BufferedReader br. } } public void run() { try { while(true) { String str=br.println(e).out. } } } ./****************************** serverthread .readLine(). InputStreamReader isr=new InputStreamReader(is). } } public void echo(String str) { try { pw.true). private PrintWriter pw. } } catch(Exception e) { System.getInputStream().java*********************************/ import java. pw=new PrintWriter(os.

168.143 .java D:\Java\jdk1.OUTPUT: D:\ Java\jdk1.5.5.5.0_03\bin>java chatserver D:\Java\jdk1.5.java D:\Java\jdk1.0_03\bin>java chatclient 192.143 D:\Java\jdk1.168.168.0_03\bin>javac chatclient.0_03\bin>javac chatserver.0_03\bin>java chatclient 192.0_03\bin>javac ServerThread.5.5.15.15.java D:\ Java\jdk1.15.0_03\bin>java chatclient 192.143 D:\Java\jdk1.5.

MINI-PROJECT .

BufferedReader. JScrollPane jsp2. JLabel jl3. import javax.awt. import java.event.ActionListener. import javax./*********************** PROGAMMER’S EDITOR IN JAVA************************/ /* Client Frame Design with width=600 & height=500*/ import java. import java.io.io.awt.ActionEvent.event. JMenu file.File. JScrollPane jsp3. import java.awt. JMenu exit. import java. JMenu help. JTabbedPane jtp3. import java.io. JLabel jl2.StringTokenizer.event.Color. import java.swing.text.event. import java. JButton jb4.awt. import java.event.swing. JButton jb3.awt.MouseMotionListener. .border. JScrollPane jsp1.io.event. import javax. import java.FileReader. import java.FileOutputStream. import java.MouseEvent. import java. JButton jb1.io. JMenuBar jm.MouseListener.WindowEvent.InputStreamReader.awt. JTabbedPane jtp1.event.Element. import java. JButton jb2.MouseMotionListener { /************ Components *****************/ JFrame frame. JMenu open.awt. JLabel jl1. JTabbedPane jtp2.awt. JTextArea jta1.MouseListener.*.swing.FileInputStream. public class Client implements ActionListener.Border. public JTextArea jta2.awt.event. import java. import java.WindowListener.util.WindowAdapter.io. JTextArea jta3.

150).EXIT_ON_CLOSE).setBorder(etchedBdr1). //frame. 200).setEnabled(false). jta1. jsp1. String option.setSize(900.setBounds(500. frame. jsp2. jta2. String className. jsp2=new JScrollPane(jta2). 670. 450. jl1=new JLabel(). jsp1. frame.setEditable(false). frame. File f2.add(jl1).setDefaultCloseOperation(JFrame. 670. jsp1=new JScrollPane(jta1). File f3.10. 670. frame.200.setBounds(10. 670. jl1. //frame. jl2. jl2=new JLabel(). 380.setBorder(etchedBdr3). frame.400). Border etchedBdr2 = BorderFactory. jta3. 280.400).createEtchedBorder(). jta2. /************ Variables *****************/ String line.createEtchedBorder().setBounds(300. //frame. 10.200).JMenu compile.add(jl2).add(jsp1).add(jsp2). .setBounds(550.setLayout(null). jta2=new JTextArea(300. jsp3=new JScrollPane(jta3). 380. frame. jsp3. public Client() { frame=new JFrame("XDoS Compiler"). Border etchedBdr1 = BorderFactory.setBorder(etchedBdr2). 670. jta3=new JTextArea(300.650). 150).setBounds(10.add(jsp3).createEtchedBorder(). String pureFile.400).setBounds(10. JMenu opt. 150). jta1=new JTextArea(300. Border etchedBdr3 = BorderFactory. JMenu run. 150).

jl2.add(jtp1).setVisible(true). jm. 560). jtp2.setBounds(500. 150).setBounds(550. 450. 0. 670.setBounds(10. 150). frame. 150). 40. 880.getSource()==jta1) { jl3. jl1. jtp1.setBounds(550. 150).remove(jtp1).setBounds(500. 535. 380.addMouseMotionListener(this). jtp2.setBounds(10.toString(getCurrentLineNumber())). 670. . 150). 670. jl3.addMouseListener(this).add(jm). 150). 30). jta1. frame. 670. 535. jtp2.remove(jtp2).setText("Line-No: "+Integer. frame.isShowing()) { frame.setBounds(600. 150). jta1. frame. } public void mouseClicked(MouseEvent ew) { if(ew.setBounds(500.addMouseListener(this). jl2. 380.addMouseMotionListener(this).setText("Line-No: "+Integer. 670. 150). 670.setResizable(false). 380.isShowing()) { frame. jl1. 535. 535.file. 535.toString(getCurrentLineNumber())).setBounds(10. jta2. 40. jta2.getSource()==jtp1) { if(jtp2. 870. jl3.add(item2). jl3.remove(jtp3).addMouseListener(this). 150).setBounds(600. 150). jl3. 670.removeMouseMotionListener(this). 535. 670. 670.setBounds(600. } } else if(ew. } else { frame. 670. 670. jtp1. 560).setBounds(5.getSource()==jtp2) { if(jtp1.setBounds(550. jl2. } else if(ew. jl1.

150). jl3.addChoosableFileFilter(new MyFilter()). 150).add(jtp3).setText("Y-: "+Integer. int n=fis.getX())). jl2. 670. jta1.available().setBounds(600. jl1. 670.toString(e.setEnabled(true). opt.printStackTrace(). fis.setBounds(10. 150). 400). jl2. filename).getName().setBounds(550.add(jtp2).} else { frame. } } } public void mouseEntered(MouseEvent ew) {} public void mouseExited(MouseEvent ew) {} public void mousePressed(MouseEvent ew) {} public void mouseReleased(MouseEvent ew) {} public void mouseMoved(MouseEvent e) { jl1. String data=new String(dat).read(dat). jtp1. byte dat[]=new byte[n].setBounds(500. } } .getY())). 670. int select=fileChooser. 670. frame. 380. fileChooser.setText("X-: "+Integer.getSelectedFile().APPROVE_OPTION) { File file=fileChooser. 380. } public void mouseDragged(MouseEvent e) {} public void actionPerformed(ActionEvent ae) {} public void open() { JFileChooser fileChooser = new JFileChooser().toString(e. try { FileInputStream fis=new FileInputStream(file). if(select==JFileChooser. 40. 380. } catch(Exception e) { e.showOpenDialog(frame).getSelectedFile(). String filename=fileChooser. jtp1.setText(data).setTitleAt(0.

String ta1=jta1. f.class").indexOf(" ".out. int a2=path.countTokens()). FileOutputStream f=new FileOutputStream(className).println(st3.close(). StringBuffer sb=new StringBuffer(ta1). StringTokenizer st3=new StringTokenizer(name.println(location). String word=st3. //System.getDefaultRootElement(). System. String colan=path.} public int getCurrentLineNumber() { int line.println(st4.out. id2). } public void compile() { try { jtp2.getAbsolutePath()).out. String name=ta1.toString(). a1).trim().trim().java". System.nextToken(). Element root = jta1.println(colan).getBytes()). f3=new File(pureFile+".trim().indexOf("public class"). a2+1). String path=f2. System.out.getText(). line = root.out. System.nextToken().indexOf("\\").getElementIndex(caretPosition) + 1." ").trim(). int id1=ta1. int a1=path.trim()+"*").trim().nextToken().substring(0.countTokens()). return line. f.setTitleAt(0.id1+13). System.getAbsolutePath().getCaretPosition().println(a1+" "+a2). StringTokenizer st4=new StringTokenizer(word. compiler(className). int caretPosition = jta1. st4. pureFile=st4. st4.out.getDocument(). } .trim().toString().substring(0."\n"). className=pureFile+".lastIndexOf("\\"). String location=path.out.toString().out.nextElement(). int id2=ta1. System.println(f2. System.substring(id1.write(ta1."Compile").println(word+"*").nextToken().println(st4. f2=new File(className).

"Run").append("Proceed.readLine()."Enter Destination System Name".append("Compilation Started. Process p =Runtime.swing. jta2.WindowsLookAndFeel"). String str=br.setText(""). BufferedReader br1 = new BufferedReader(fr).toString()..out.readLine().catch (Exception err) { err. str=br."Destination".readLine().bat "+name. //System..sun.out.setText(line). runer(pureFile). // jta2. String eachLine = br1. while (eachLine != null) { jta2. } public void compiler(String name) { try { jta2.java.getRuntime(). FileReader fr = new FileReader(f1).txt"). } File f1 = new File("error.getInputStream())). while(str!=null) { System. } //option=JOptionPane.. } public void run() { jtp2.printStackTrace(). StringBuffer sb1 = new StringBuffer().exec(callAndArgs). BufferedReader br=new BufferedReader(new InputStreamReader(p.setForeground(Color. } catch (Exception e) { } new Client().\n")..setTitleAt(0. jta2.RED). } public static void main(String args[]) { try { UIManager. jta2....1).windows.println(str).showInputDialog(null.setLookAndFeel("com. String callAndArgs= "cmd /c compile.. .\n").println(option).setForeground(Color.blue).plaf.