Ashish Yadav
Posts: 1
Nickname: ashish1593
Registered: Apr, 2014
Problem in runnig java code
Posted: Apr 1, 2014 11:09 AM
Advertisement
Can any one help in running this java code below import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import javax.swing.tree.*; import javax.swing.text.*; import javax.swing.border.*; class TestHtml extends JFrame implements ActionListener { public static int text=1; public static int applet=2; public static int hyperlink=3; public static int linebreak=4; public static int paragraph=5; public static int picture=6; public static int line=7; public static int align=8; public static int font=9; public static int bcolor=10; public static int fcolor=11; public static int h=12; public static int h1=13; public static int h2=14; public static int h3=15; public static int h4=16; public static int h5=17; public static int h6=18; public static int h7=19; public static int gtitle=20; public static int ghead=21; String master,child; int flag=0,tt; int stposition=0; int option=-1; public String gettext,opfile=null; String wh; int mousex,mousey; Toolkit tkit=Toolkit.getDefaultToolkit(); FileOutputStream out; FileInputStream in; JComboBox add,b1color,f1color,hhead,fontstyle,script1; JButton addscript; JButton exit1,smile,bug,circum,spiderer,new1,remove1,save1,middle,open1,bullet; JButton table,insert,save,quit,bold,italics,underl,center,left,right,fileo,title,headin g,preview; JMenuItem item77,item78,item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item 11,item12,item13; JMenuItem textcopy,textcut,textpaste,selectall,item566,itapplet,ithyper,itline,itpara; JEditorPane field; JMenuBar mbr; //JMenuBar mbr1; JPopupMenu jpop; JPanel p1,p2,p3,p4,p5,p6; JSplitPane sp1,sp2,sp3; JScrollPane jsp,jt; JTree tree; TestHtml() { super("WebsEye"); setSize(800,800); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); mbr=new JMenuBar(); setJMenuBar(mbr); jpop=new JPopupMenu(); DefaultMutableTreeNode top=new DefaultMutableTreeNode ("Options"); DefaultMutableTreeNode a=new DefaultMutableTreeNode ("Heading"); top.add(a); DefaultMutableTreeNode a1=new DefaultMutableTreeNode ("<h></h>"); a.add(a1); DefaultMutableTreeNode a2=new DefaultMutableTreeNode ("<h1></h1>"); a.add(a2); DefaultMutableTreeNode a3=new DefaultMutableTreeNode ("<h2></h2>"); a.add(a3); DefaultMutableTreeNode a4=new DefaultMutableTreeNode ("<h3></h3>"); a.add(a4); DefaultMutableTreeNode a5=new DefaultMutableTreeNode ("<h4></h4>"); DefaultMutableTreeNode a6=new DefaultMutableTreeNode ("<h5></h5>"); DefaultMutableTreeNode a7=new DefaultMutableTreeNode ("<h6></h6>"); DefaultMutableTreeNode a8=new DefaultMutableTreeNode ("<h7></h7>"); a.add(a5); a.add(a6); a.add(a7); a.add(a8); DefaultMutableTreeNode b=new DefaultMutableTreeNode ("Table"); top.add(b); tree=new JTree(top); tree.setBackground(new Color(212,208,200)); selectall=new JMenuItem("SelectAll"); JMenu file=new JMenu("File"); file.setMnemonic('F'); file.add(item1=new JMenuItem("New")); file.add(item2=new JMenuItem("Open")); file.add(item3=new JMenuItem("Save")); file.add(item4=new JMenuItem("SaveAs")); file.add(item5=new JMenuItem("Close")); file.add(item6=new JMenuItem("Exit")); file.setBackground(new Color(212,208,200)); file.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); mbr.add(file); item1.setMnemonic('N'); item2.setMnemonic('O'); item3.setMnemonic('S'); item5.setMnemonic('C'); item6.setMnemonic('X'); /* /////////////*/ //System.out.println(opfile); JMenu edit=new JMenu("Edit"); edit.add(item7=new JMenuItem("Cut")); edit.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); edit.add(item8=new JMenuItem("Copy")); edit.add(item9=new JMenuItem("Paste")); edit.add(item566=new JMenuItem("SelectAll")); edit.setBackground(new Color(212,208,200)); edit.setMnemonic('E'); mbr.add(edit); JMenu view=new JMenu("View"); view.setMnemonic('V'); view.setBackground(new Color(212,208,200)); view.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); view.add(item77=new JMenuItem("Explorer")); mbr.add(view); JMenu insertm=new JMenu("Insert"); insertm.setBackground(new Color(212,208,200)); insertm.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); insertm.add(item12=new JMenuItem("Text")); insertm.add(item13=new JMenuItem("Picture")); insertm.add(itapplet=new JMenuItem("Applet")); insertm.add(ithyper=new JMenuItem("Hyper Link")); insertm.add(itline=new JMenuItem("Line Break")); insertm.add(itpara=new JMenuItem("Paragraph")); insertm.setMnemonic('I'); mbr.add(insertm); // mbr1=new JMenuBar();//=========================== JMenu help=new JMenu("Help"); help.setBackground(new Color(212,208,200)); help.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); help.add(item78=new JMenuItem("Help")); help.add(item11=new JMenuItem("About")); help.setMnemonic('H'); mbr.add(help); mbr.setBackground(new Color(212,208,200)); p1=new JPanel(); // p1.add(mbr1); p2=new JPanel(); p2.setBorder(BorderFactory.createLoweredBevelBorder()); p3=new JPanel(); p3.setBorder(BorderFactory.createLoweredBevelBorder()); p4=new JPanel(); p4.setBorder(BorderFactory.createLoweredBevelBorder()); p5=new JPanel(); p5.setBorder(BorderFactory.createLoweredBevelBorder()); p1.setBorder(BorderFactory.createLoweredBevelBorder()); p6=new JPanel(); p1.add(p5); //p1.add(p6); field=new JEditorPane(); field.setPreferredSize(new Dimension(18000,18000)); field.setContentType("text/plain"); // field.setSelectionColor(Color.blue); field.setSelectedTextColor(Color.red); field.setMinimumSize(new Dimension(175,175)); field.setMaximumSize(new Dimension(18000,18000)); jsp=new JScrollPane(field);//,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORI ZONTAL_SCROLLBAR_AS_NEEDED); jt=new JScrollPane(tree,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTA L_SCROLLBAR_ALWAYS); insert =new JButton("INSERT"); fileo=new JButton("FILE"); fileo.setPreferredSize(new Dimension(50,30)); fileo.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); table=new JButton("TABLE"); table.setPreferredSize(new Dimension(50,30)); title=new JButton("TITLE"); title.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); title.setPreferredSize(new Dimension(50,30)); preview=new JButton("PREVIEW"); preview.setPreferredSize(new Dimension(75,30)); preview.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); preview.setBackground(new Color(212,208,200)); heading=new JButton("HEAD"); heading.setPreferredSize(new Dimension(50,30)); save=new JButton("SAVE"); save.setPreferredSize(new Dimension(50,30)); insert.setPreferredSize(new Dimension(50,30)); textcut=new JMenuItem("Cut"); textpaste=new JMenuItem("Paste"); textcopy=new JMenuItem("Copy"); jpop.add(textcopy); jpop.add(textcut); jpop.add(textpaste); jpop.add(selectall); quit=new JButton("QUIT"); quit.setPreferredSize(new Dimension(50,30)); quit.setBackground(Color.green); add=new JComboBox(); fontstyle=new JComboBox(); hhead=new JComboBox(); script1=new JComboBox(); b1color=new JComboBox(); f1color=new JComboBox(); script1.addItem("CLOCK"); script1.addItem("CONFIRM"); script1.addItem("SCROLLING_TEXT"); b1color.addItem("BACKGROUND"); b1color.addItem("RED"); b1color.addItem("GREEN"); f1color.addItem("FONTCOLOR"); f1color.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); f1color.addItem("RED"); f1color.addItem("GREEN"); f1color.addItem("BLACK"); RedCircle ico=new RedCircle(); // ImageIcon ic=new ImageIcon("c.jpg"); //bullet=new JButton(new ImageIcon("bullet.gif"); //bullet.preferredSize(new Dimension(20,20)); bold=new JButton("B",ico); bold.setPreferredSize(new Dimension(45,30)); bold.setFont(new Font("TimesNewRoman",Font.BOLD,11)); italics=new JButton("I"); italics.setPreferredSize(new Dimension(45,30)); italics.setFont(new Font("TimesNewRoman",Font.ITALIC,11)); underl=new JButton("U"); underl.setPreferredSize(new Dimension(45,30)); underl.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); center=new JButton(new ImageIcon("center.gif")); center.setBorderPainted(false); center.setPreferredSize(new Dimension(50,30)); left=new JButton(new ImageIcon("left.gif")); left.setBorderPainted(false); left.setPreferredSize(new Dimension(50,30)); right=new JButton(new ImageIcon("right.gif")); right.setBorderPainted(false); right.setPreferredSize(new Dimension(50,30)); right.setToolTipText("right"); fileo.setBackground(new Color(212,208,200)); fileo.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); table.setBackground(new Color(212,208,200)); table.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); right.setBackground(new Color(212,208,200)); left.setBackground(new Color(212,208,200)); center.setBackground(new Color(212,208,200)); bold.setBackground(new Color(212,208,200)); italics.setBackground(new Color(212,208,200)); underl.setBackground(new Color(212,208,200)); hhead.setBackground(new Color(212,208,200)); b1color.setBackground(new Color(212,208,200)); b1color.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); f1color.setBackground(new Color(212,208,200)); title.setBackground(new Color(212,208,200)); insert.setBackground(new Color(212,208,200)); insert.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); save.setBackground(new Color(212,208,200)); save.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); quit.setBackground(new Color(212,208,200)); quit.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); heading.setBackground(new Color(212,208,200)); heading.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); add.setBackground(new Color(212,208,200)); add.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); hhead.addItem("HEAD"); hhead.addItem("h1"); hhead.addItem("h2"); hhead.addItem("h3"); hhead.addItem("h4"); hhead.addItem("h5"); hhead.addItem("h6"); hhead.addItem("h7"); hhead.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); add.addItem("Objects"); add.addItem("Applet"); add.addItem("Hyper Link"); add.addItem("Line Break"); add.addItem("Text"); add.addItem("Paragraph"); add.addItem("Picture"); add.addItem("MetaTags"); fontstyle.addItem("FONTFACE"); fontstyle.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment(); String gss[]=ge.getAvailableFontFamilyNames(); for(int i=0;i<gss.length;++i) fontstyle.addItem(gss); fontstyle.setBackground(new Color(212,208,200)); //tip.setComponent(save); //save.createToolTip("dfgdg",JToolTip.WHEN_FOCUSED,J4.CENTER_ALIGNMENT); //tip.setTipText("press to save file"); /*-------------------------------------------------------------------------- --- JToolBar toolBar = new JToolBar(JToolBar.VERTICAL); toolBar.setBorder(BorderFactory.createRaisedBevelBorder()); toolBar.add(new JButton(new ImageIcon("print.gif"))); //toolBar.add(new JMenuItem("object")); toolBar.setBackground(new Color(212,208,200)); //JPanel contentPane = new JPanel(); //contentPane.setLayout(new BorderLayout()); //contentPane.setPreferredSize(new Dimension(400, 100)); //add tool bar when ever necessary........... //contentPane.add(toolBar, BorderLayout.WEST);// p4.add(contentPane); //contentPane.add(scrollPane, BorderLayout.CENTER); p4.add(toolBar); -------------------------------------------------------------- --------*/ start(); body(); getChoice(); setVisible(true); } public void start() { jsp.setMinimumSize(new Dimension(500,350)); jsp.setPreferredSize(new Dimension(500,350)); jsp.setMaximumSize(new Dimension(500,350)); p1.setBackground(new Color(212,208,200));//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p2.setBackground(new Color(212,208,200)); p3.setBackground(new Color(212,208,200)); p4.setBackground(new Color(212,208,200)); p5.setBackground(new Color(212,208,200)); p6.setBackground(new Color(212,208,200)); p1.setMinimumSize(new Dimension(50,50)); p1.setPreferredSize(new Dimension(50,80)); p1.setMaximumSize(new Dimension(75,75)); //p2.add(jt); p2.setMinimumSize(new Dimension(75,125)); p2.setPreferredSize(new Dimension(150,75)); p2.setMaximumSize(new Dimension(75,75)); p3.setMinimumSize(new Dimension(50,50)); p3.setPreferredSize(new Dimension(50,50)); p3.setMaximumSize(new Dimension(50,50)); p4.setMinimumSize(new Dimension(175,175)); p4.setPreferredSize(new Dimension(175,175)); p4.setMaximumSize(new Dimension(175,175)); sp1=new JSplitPane(JSplitPane.VERTICAL_SPLIT); sp2=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); sp3=new JSplitPane(JSplitPane.VERTICAL_SPLIT); sp2.setMinimumSize(new Dimension(175,100)); sp2.setPreferredSize(new Dimension(150,100)); sp2.setMaximumSize(new Dimension(175,175)); sp3.setMinimumSize(new Dimension(175,100)); sp3.setPreferredSize(new Dimension(175,100)); sp3.setMaximumSize(new Dimension(175,175)); Container c=getContentPane(); c.add("Center",sp1); sp1.setRightComponent(sp2); sp2.setBottomComponent(sp3); sp1.setLeftComponent(p1); sp2.setLeftComponent(p2); sp3.setLeftComponent(p3); sp3.setRightComponent(p4); // testing start JPanel red=new JPanel(); JPanel green=new JPanel(); JPanel blue=new JPanel(); green.setBackground(new Color(212,208,200)); blue.setBackground(new Color(212,208,200)); green.setMinimumSize(new Dimension(150,300)); green.setMaximumSize(new Dimension(150,300)); green.setPreferredSize(new Dimension(150,300)); blue.setMinimumSize(new Dimension(150,300)); blue.setMaximumSize(new Dimension(150,300)); blue.setPreferredSize(new Dimension(150,300)); jt.setMinimumSize(new Dimension(150,300)); jt.setMaximumSize(new Dimension(150,300)); jt.setPreferredSize(new Dimension(150,300)); green.add(jt); blue.add(script1); script1.setBackground(new Color(212,208,200)); addscript=new JButton("ADD"); addscript.setBorderPainted(false); addscript.setBackground(new Color(212,208,200)); blue.add("North",addscript); JTabbedPane tab=new JTabbedPane(JTabbedPane.TOP); tab.setBackground(new Color(212,208,200)); tab.addTab("TAGS",green); tab.setFont(new Font("TimesNewRoman",Font.PLAIN,11)); tab.addTab("SCRIPT",blue); tab.setSelectedIndex(0); p2.add(tab); //testing end p1.setLayout(new FlowLayout(FlowLayout.LEFT)); p5.add(fileo); p5.add(new JLabel(" ")); JMenuBar mbr2=new JMenuBar(); mbr2.add(fontstyle); p3.add(mbr2); mbr2.add(add); p5.add(title); p5.add(heading); p5.add(table); p5.add(preview); mbr2.add(hhead); mbr2.add(b1color); mbr2.add(f1color); p4.add("Center",jsp); p5.add(insert); p5.add(save); p5.add(quit); p5.add(bold); p5.add(italics); p5.add(underl); p5.add(left); p5.add(center); p5.add(right); //mbr.add(" "); p1.add(save1=new JButton(new ImageIcon("save1.gif"))); save1.setPreferredSize(new Dimension(20,20)); p1.add(open1=new JButton(new ImageIcon("open1.gif"))); open1.setPreferredSize(new Dimension(20,20)); p1.add(middle=new JButton(new ImageIcon("middle.gif"))); middle.setPreferredSize(new Dimension(20,20)); p1.add(new1=new JButton(new ImageIcon("new1.gif"))); new1.setPreferredSize(new Dimension(20,20)); p1.add(remove1=new JButton(new ImageIcon("remove1.gif"))); remove1.setPreferredSize(new Dimension(20,20)); p1.add(exit1=new JButton(new ImageIcon("exit1.gif"))); exit1.setPreferredSize(new Dimension(20,20)); p1.add(smile=new JButton(new ImageIcon("smile.gif"))); smile.setPreferredSize(new Dimension(20,20)); smile.addActionListener(this); p1.add(spiderer=new JButton(new ImageIcon("spiderer.gif"))); spiderer.setPreferredSize(new Dimension(20,20)); //p3.add(smile=new JButton(new ImageIcon("bf.gif"))); p1.add(bug=new JButton(new ImageIcon("bugging.gif"))); bug.setPreferredSize(new Dimension(20,20)); p1.add(circum=new JButton(new ImageIcon("circum.gif"))); circum.setPreferredSize(new Dimension(20,20)); p1.add(bullet=new JButton(new ImageIcon("bullets.gif"))); bullet.setPreferredSize(new Dimension(20,20)); smile.setBackground(new Color(212,208,200)); bullet.setBackground(new Color(212,208,200)); bug.setBackground(new Color(212,208,200)); spiderer.setBackground(new Color(212,208,200)); save1.setBackground(new Color(212,208,200)); remove1.setBackground(new Color(212,208,200)); new1.setBackground(new Color(212,208,200)); exit1.setBackground(new Color(212,208,200)); open1.setBackground(new Color(212,208,200)); middle.setBackground(new Color(212,208,200)); save1.addActionListener(this); open1.addActionListener(this); exit1.addActionListener(this); new1.addActionListener(this); remove1.addActionListener(this); bullet.addActionListener(this); setVisible(true); } public static void main(String args[]) { TestHtml z=new TestHtml(); } public void body() { field.setBackground(new Color(255,255,255)); wh="\n\n\n<HTML>\n<HEAD>\n<TITLE>\n</TITLE>\n</HEAD& gt;\n<BODY>\n</BODY>\n<HTML>\n"; try{ //System.out.println(wh); field.setText(wh); }catch(Exception e21){} } public void getChoice() { //============================================================================ ===== new1.setToolTipText("new file"); remove1.setToolTipText("remove"); save1.setToolTipText("save"); middle.setTool TipText("center"); table.setToolTipText("Table"); quit.setToolTipText("Quit"); b old.setToolTipText("Bold"); italics.setToolTipText("Italics"); underl.setToolTip Text("Under Line"); center.setToolTipText("Center"); left.setToolTipText("left"); right.se tToolTipText("right"); fileo.setToolTipText("File Open"); title.setToolTipText("Title"); heading.setToolTipText("Heading"); previ ew.setToolTipText("To view Preview"); exit1.setToolTipText("Click to exit"); smile.setToolTipText("Meta objects to insert"); insert.addActionListener(this); insert.setBorderPainted(false); insert.addMouseListener(new MyListener(this)); preview.addActionListener(this); preview.setBorderPainted(false); preview.addMouseListener(new MyListener(this)); save.addActionListener(this); save.setBorderPainted(false); save.addMouseListener(new MyListener(this)); quit.addActionListener(this); quit.setBorderPainted(false); quit.addMouseListener(new MyListener(this)); title.addActionListener(this); title.setBorderPainted(false); title.addMouseListener(new MyListener(this)); heading.addActionListener(this); heading.setBorderPainted(false); heading.addMouseListener(new MyListener(this)); fileo.addActionListener(this); fileo.setBorderPainted(false); fileo.addMouseListener(new MyListener(this)); bold.addActionListener(this); bold.setBorderPainted(false); bold.addMouseListener(new MyListener(this)); italics.addActionListener(this); italics.setBorderPainted(false); italics.addMouseListener(new MyListener(this)); underl.addActionListener(this); underl.setBorderPainted(false); underl.addMouseListener(new MyListener(this)); left.addActionListener(this); table.addActionListener(this); table.setBorderPainted(false); table.addMouseListener(new MyListener(this)); center.addActionListener(this); item11.addActionListener(this); field.addMouseListener(new MyListener(this)); b1color.addActionListener(new ComboListener(this)); f1color.addActionListener(new Combo1Listener(this)); fontstyle.addActionListener(new Combo2Listener(this)); hhead.addActionListener(new Combo3Listener(this)); //left.addActionListener(this); right.addActionListener(this); right.addMouseListener(new MyListener(this)); left.addMouseListener(new MyListener(this)); center.addMouseListener(new MyListener(this)); item1.addActionListener(this); item3.addActionListener(this); item4.addActionListener(this); item2.addActionListener(this); item6.addActionListener(this); item12.addActionListener(this); item13.addActionListener(this); item5.addActionListener(this); item77.addActionListener(this); item78.addActionListener(this); addscript.addActionListener(this); item7.addActionListener(this); item8.addActionListener(this); item9.addActionListener(this); textcopy.addActionListener(this); textcut.addActionListener(this); textpaste.addActionListener(this); selectall.addActionListener(this); item566.addActionListener(this); itapplet.addActionListener(this); ithyper.addActionListener(this); itline.addActionListener(this); itpara.addActionListener(this); addKeyListener(new Klist(this)); requestFocus(); } public void actionPerformed(ActionEvent e) { field.setForeground(Color.red); String s=new String(); s=e.getActionCommand(); /*JButton e.getSource()=new JButton(); e.getSource()=(JButton)e.getSource();*/ if(e.getSource()==itapplet) { option=2;service1(option);} if(e.getSource()==ithyper) {option=3;service1(option);} if(e.getSource()==itline) {option=4;service1(option);} if(e.getSource()==itpara) {option=5;service1(option);} if(e.getSource()==bullet) { new DialogBullet(this);} if(s.equals("SelectAll")) { field.selectAll(); } if(s.equals("Help")) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE F:\\Html prg\\Babel.htm"); } catch(Exception e12){} } if(s.equals("INSERT")) { String req=(String)add.getSelectedItem(); if(req.equals("Objects")) JOptionPane.showMessageDialog(null, "Select an object","Web's Eye", JOptionPane.ERROR_MESSAGE); if(req.equals("Text")) option=text; if(req.equals("Applet")) option=applet; if(req.equals("Picture")) option=picture; if(req.equals("Hyper Link")) option=hyperlink; if(req.equals("Line Break")) option=linebreak; if(req.equals("Paragraph")) option=paragraph; if(req.equals("MetaTags")) new MetaTags(this); service1(option); } if(s.equals("About")) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE e:\\dileep\\test\\new_page_1.htm"); } catch(Exception e12){} } if(s.equals("PREVIEW")) { try{ new PreView(this); } catch(Exception ecn) { ecn.printStackTrace(); } } if(e.getSource()==smile) { new MetaTags(this); } if(s.equals("TABLE")) { new TableDialog(this,"Details for table"); } if(s.equals("Close")) { checkSave(); if(tt!=2) field.setText(""); } if(s.equals("QUIT")||s.equals("Exit")||e.getSource()==exit1) { checkSave(); if(tt!=2) System.exit(0); } if(s.equals("SAVE")||s.equals("SaveAs")||e.getSource()==save1 ) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); out=new FileOutputStream(f); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } if(s.equals("Save")) { if(opfile!=null) { try { File f5=new File(opfile); out=new FileOutputStream(f5); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } else if(opfile==null) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); out=new FileOutputStream(f); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } } if(s.equals("Cut")||e.getSource()==remove1) { field.cut(); } if(s.equals("Copy")) { field.copy(); } if(s.equals("Paste")) { field.paste(); } if(s.equals("Explorer")) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE "); } catch(Exception e12){} } if(s.equals("TITLE")) { option=20; service1(option); } if(s.equals("B")) { option= 50; writeData("<B></B>"); } if(s.equals("I")) { option=51; writeData("<I></I>"); } if(s.equals("U")) { option=52; writeData("<U></U>"); } if(e.getSource()==left) { option=53; writeData("<P align=\"left\">"); } if(e.getSource()==right) { option=54; writeData("<P align=\"right\">"); } if(e.getSource()==center) { option=55; writeData("<center></center>"); } if(s.equals("HEAD")) { option=21; service1(option); } if(s.equals("New")||e.getSource()==new1) { checkSave(); if(tt!=2) {body();opfile=null;tt=-2;} else if(tt==2) { try { File f5=new File(opfile); out=new FileOutputStream(f5); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} body();opfile=null;tt=-2; } } if(s.equals("FILE")||s.equals("Open")||e.getSource()==open1) { try { opfile=null; File fo=new File(getFile()); in=new FileInputStream(fo); String sss=new String(); byte bbb; while((bbb=(byte)in.read())!=-1) sss=sss+(char)bbb; field.setText(sss); } catch(Exception e3) { System.out.println(e3); } } if(s.equals("ADD")) { String tempp=(String)script1.getSelectedItem(); if(tempp.equals("CLOCK")) { option=374; try { writeData(readFiles("Script_clock.txt"));//check option }catch(Exception ennn){} } else if(tempp.equals("SCROLLING_TEXT")); { option=374; try { writeData(readFiles("Script_scroll.txt"));//check option }catch(Exception ennn){} } if(tempp.equals("CONFIRM")) { option=374; try { writeData(readFiles("Script_confirm.txt"));//check option }catch(Exception ennn){} } } if(s.equals("Text")) { option=1; service1(option); } if(s.equals("Picture")) { option=6; service1(option); } } public void service1(int opt) { switch(opt) { case 1 : case 20: case 21: getTextData();break; case 2 : writeData(getFile());break; case 4 : writeData("<BR>");break; case 5 : writeData("<p>");break; case 6 : writeData(getFile());break; case 3 : writeData("<a href= "+getFile()+">Go=></a>");break; } } public void getTextData() { new TextDialog(this,"DILEEP EDITTOR"); } public void writeData(String data) { try{ getPosition("</BODY>"); if((option==text)||(option==2)||(option==374)||(option==3)||(option==50)||(opti on==51)||(option==52)||(option==53)||(option==54)||(option==55)) { field.setText(master+"\n"+data+child); option=-1; } if(option==picture) { field.setText(master+"\n<img src=\" " +data +"\"" +"align=middle>"+child); option=-1; } /* if(option==2) { field.setText(master+"\n<applet code=\" " +data +"\"" +"width=400 height=400 >"+child); option=-1; }*/ if((option==4)||(option==5)) { field.setText(master+"\n"+data+child); option=-1; } if(option==20) { getPosition("</TITLE>"); field.setText(master+"\n"+data+child); option=-1; } if(option==21) { option=-1; getPosition("</HEAD>"); field.setText(master+"\n"+data+child); } }catch(Exception e20){} } public void checkSave() { //================================================ if (opfile==null) { tkit.beep(); tt=JOptionPane.showConfirmDialog(this,"SAVE NOW!","YOU DIDN'T SAVED", JOptionPane.YES_NO_CANCEL_OPTION); if(tt==0) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); out=new FileOutputStream(f); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } } } public void writeTable(int row,int col,String align,String bgd,String bgc,String fr,String rul) { getPosition("</BODY>"); try { field.setText(master+"\n"+"<TABLE \n ALIGN= "+align+" BACKGROUND=\""+bgd+"\" BORDERCOLOR=\""+bgc+"\" RULES= "+rul+" FRAME= "+fr+">"+child); for(int i=1;i<=row;++i) { getPosition("</BODY>"); field.setText(master+"\n"+"<TR><!--Row "+i+">"+child); for(int j=1;j<=col;++j) { getPosition("</BODY>"); // wh.insert("\n"+"<TD></TD>",stposition); field.setText(master+"\n"+"<TD></TD>"+child); getPosition("</BODY>"); // wh.insert("\n"+"</TR>",stposition); field.setText(master+"\n"+"</TR>"+child); } } getPosition("</BODY>"); //wh.insert("\n"+"<TABLE>",stposition); field.setText(master+"\n"+"<TABLE>"+child); } catch(Exception te) { System.out.println(te); } } public void getPosition(String find) { wh=field.getText(); stposition=wh.indexOf(find); //System.out.println(wh); stposition=stposition-1; master=new String(); child=new String(); master=wh.substring(0,stposition); child=wh.substring(stposition); } String getFile() { FileDialog f=null; f=new FileDialog(this); f.setMode(FileDialog.LOAD); f.show(); return f.getDirectory()+f.getFile(); } String readFiles(String fname) throws Exception { byte b; String fss=new String(); FileInputStream ffin=new FileInputStream(fname); while((b=(byte)ffin.read())!=-1) fss=fss+(char)b; return fss; } } class ComboListener implements ActionListener { TestHtml ht; ComboListener(TestHtml t) { ht=t; } public void actionPerformed(ActionEvent e) { ht.getPosition("</BODY>"); String st=(String)ht.b1color.getSelectedItem(); if (st.equals("BACKGROUND")) st="yellow"; try{ ht.field.setText(ht.master+"\n <bgcolor =\""+st+" \">"+ht.child); }catch(Exception e11){} } } class Combo1Listener implements ActionListener { TestHtml ht; Combo1Listener(TestHtml t) { ht=t; } public void actionPerformed(ActionEvent e) { ht.getPosition("</BODY>"); String st=(String)ht.f1color.getSelectedItem(); if (st.equals("FONTCOLOR")) st="Black"; try{ ht.field.setText(ht.master+"\n <Font color =\""+st+" \"></Font>"+ht.child); }catch(Exception e12){} } } class Combo2Listener implements ActionListener { TestHtml ht; Combo2Listener(TestHtml t) { ht=t; } public void actionPerformed(ActionEvent e) { ht.getPosition("</BODY>"); String st=(String)ht.fontstyle.getSelectedItem(); if (st.equals("FONTFACE")) st="TimesNewRoman"; try{ ht.field.setText(ht.master+"\n <Font face =\""+st+" \"></Font>"+ht.child); }catch(Exception e13){} } } class Combo3Listener implements ActionListener { TestHtml ht; Combo3Listener(TestHtml t) { ht=t; } public void actionPerformed(ActionEvent e) { try{ ht.getPosition("</BODY>"); String st=(String)ht.hhead.getSelectedItem(); if (st.equals("HEAD")) { st="h1"; ht.field.setText(ht.master+"\n <h1></h1>"+ht.child); } if(st.equals("h1")) ht.field.setText(ht.master+"<h1></h1>"+ht.child); if(st.equals("h1")) ht.field.setText(ht.master+"\n <h1></h1>"+ht.child); if(st.equals("h2")) ht.field.setText(ht.master+"\n <h2></h2>"+ht.child); if(st.equals("h3")) ht.field.setText(ht.master+"\n <h3></h3>"+ht.child); if(st.equals("h4")) ht.field.setText(ht.master+"\n <h4></h4>"+ht.child); if(st.equals("h5")) ht.field.setText(ht.master+"\n <h5></h5>"+ht.child); if(st.equals("h6")) ht.field.setText(ht.master+"\n <h6></h6>"+ht.child); if(st.equals("h7")) ht.field.setText(ht.master+"\n <h7></h7>"+ht.child); }catch(Exception e15){} } } class MyListener extends MouseAdapter { TestHtml m; MyListener(TestHtml n) { m=n; } public void mouseEntered(MouseEvent e) { if(e.getSource() instanceof JButton) { JButton ob=new JButton(); ob=(JButton)e.getSource(); ob.setBorderPainted(true); ob.setBorder(BorderFactory.createRaisedBevelBorder()); } } public void mouseExited(MouseEvent e) { if(e.getSource() instanceof JButton) { JButton ob=new JButton(); ob=(JButton)e.getSource(); ob.setBorderPainted(false); } } public void mousePressed(MouseEvent e) { int s=e.getModifiers(); if(s==4) { m.field.add(m.jpop); m.jpop.show(m.field,e.getX(),e.getY()); m.mousex=e.getX();m.mousey=e.getY(); } } } class Klist extends KeyAdapter { TestHtml w; Klist(TestHtml kt) { w=kt; } public void keyPressed(KeyEvent ke) { int k=-1; k=ke.getKeyCode(); if(k==115) { w.checkSave(); if(w.tt!=2) System.exit(0); } if(k==114) { w.checkSave(); if(w.tt!=2) w.field.setText(""); } if(k==116) { if(w.opfile!=null) { try { File f5=new File(w.opfile); w.out=new FileOutputStream(f5); String whole=w.field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) w.out.write(b); } catch(Exception e1) {System.out.println(e1);} } else if(w.opfile==null) { FileDialog file=new FileDialog(w); file.setMode(FileDialog.SAVE); file.show(); try { w.opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); w.out=new FileOutputStream(f); String whole=w.field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) w.out.write(b); } catch(Exception e1) {System.out.println(e1);} } } } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class Selection extends JFrame implements ActionListener { JFrame f; JPanel p,q,r; JButton b1,b2,b3; Selection() { super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); f=new JFrame(); f.setSize(800,800); r=new JPanel(); p=new JPanel(); q=new JPanel(); p.setBackground(new Color(0,232,0)); q.setLayout(new GridLayout(3,1)); b1=new JButton(new ImageIcon("ameture1.gif")); b3=new JButton(new ImageIcon("rosey.gif")); b3.setBackground(new Color(0,232,0)); b3.setPreferredSize(new Dimension(800,200)); r.setPreferredSize(new Dimension(800,200)); r.add(b3); q.add(r); b2=new JButton(new ImageIcon("prof.gif")); b2.setPreferredSize(new Dimension(800,200)); q.add(b1); b1.setCursor(new Cursor(Cursor.HAND_CURSOR)); b2.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { b2.setIcon(new ImageIcon("prfire.gif")); } public void mouseExited(MouseEvent e) { b2.setIcon(new ImageIcon("prof.gif")); } }); b1.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { b1.setIcon(new ImageIcon("amfire.gif")); } public void mouseExited(MouseEvent e) { b1.setIcon(new ImageIcon("ameture1.gif")); } }); b2.setCursor(new Cursor(Cursor.HAND_CURSOR)); q.add(b2); Container c=f.getContentPane(); c.setBackground(new Color(0,232,0)); b1.setPreferredSize(new Dimension(600,100)); b1.addActionListener(this); b2.addActionListener(this); p.setBackground(new Color(0,232,0)); c.setLayout(new FlowLayout(FlowLayout.CENTER)); b1.setBackground(new Color(0,232,0)); b2.setBackground(new Color(0,232,0)); b1.setToolTipText("Ameture mode for beginners"); b2.setToolTipText("Professional mode for experts"); c.add("Center",q); } public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) new TestHtml(); if(e.getSource()==b2) new TestHtml1(); f.setVisible(false); } public void show() { f.setVisible(true); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class TextDialog extends JFrame implements ActionListener { TestHtml z2; JPanel p,q; JScrollPane jsp; JButton ok; JTextArea field; String text=null; TextDialog(TestHtml parent,String title) { //super(parent,title); super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); setSize(300,300); Container c=getContentPane(); z2=parent; field=new JTextArea(5,20); jsp=new JScrollPane(field); ok=new JButton("OK"); p=new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new JPanel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); p.add(jsp); q.add(ok); c.add("Center",p); c.add("South",q); setVisible(true); ok.addActionListener(this); } public void close() { setVisible(false); } public void actionPerformed(ActionEvent e) { text=field.getText(); if (z2.flag==2) z2.gettext=text; else z2.writeData(text); close(); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; class TestTabs extends JFrame { JPanel red,green,blue; JTabbedPane tab; TestTabs() { super("testing JTabbed Pane"); setSize(400,400); red=new JPanel(); green=new JPanel(); blue=new JPanel(); red.setBackground(Color.red); green.setBackground(Color.green); blue.setBackground(Color.blue); red.setMinimumSize(new Dimension(300,300)); red.setMaximumSize(new Dimension(300,300)); red.setPreferredSize(new Dimension(300,300)); green.setMinimumSize(new Dimension(300,300)); green.setMaximumSize(new Dimension(300,300)); green.setPreferredSize(new Dimension(300,300)); blue.setMinimumSize(new Dimension(300,300)); blue.setMaximumSize(new Dimension(300,300)); blue.setPreferredSize(new Dimension(300,300)); tab=new JTabbedPane(JTabbedPane.TOP); tab.addTab("RED",new ImageIcon("a.ico"),red); tab.addTab("GREEN",green); tab.addTab("BLUE",blue); tab.setSelectedIndex(1); Container c=getContentPane(); c.add("Center",tab); setVisible(true); } import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TableDialog extends Frame implements ActionListener { TestHtml z2; Panel p,q; Button ok; TextField row,column,backcolor,bordercolor; CheckboxGroup align; Checkbox left,center,right; Choice ch,ch1; String r,c; TableDialog(TestHtml parent,String title) { //super(parent,title); super("WebsEye"); setSize(500,500); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); align=new CheckboxGroup(); z2=parent; ch=new Choice(); ch1=new Choice(); row=new TextField(20); backcolor=new TextField(20); bordercolor=new TextField(20); column=new TextField(20); ch.add("VOID");ch.add("BORDER");ch.add("ABOVE");ch.add("BELOW");ch.add("HSIDES" ); ch.add("LHS");ch.add("RHS");ch.add("VSIDES");ch.add("BOX"); ch1.add("NONE");ch1.add("ROWS");ch1.add("COLS");ch1.add("GROUPS");ch1.add("ALL" ); ok=new Button("OK"); p=new Panel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new Panel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.add(new Label("ROWS")); p.add(row); p.add(new Label("COLUMNS")); p.add(column); p.add(new Label("Align The Text : ")); p.add(left=new Checkbox("Left",align,true)); p.add(center=new Checkbox("Center",align,false)); p.add(right=new Checkbox("Right",align,false)); p.add(new Label("Select Frame")); p.add(new Label("BackGround=\"url\"")); p.add(backcolor); p.add(new Label("Border Color:")); p.add(bordercolor); p.add(ch); p.add(new Label("Rules :")); p.add(ch1); q.add(ok); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); row.setText("0"); column.setText("0"); backcolor.setText("polar.jpeg"); bordercolor.setText("#RRGGBB"); add("Center",p); add("South",q); setVisible(true); ok.addActionListener(this); } public void close() { setVisible(false); } public void actionPerformed(ActionEvent e) { int ro=Integer.parseInt(row.getText()); int co=Integer.parseInt(column.getText()); z2.writeTable(ro,co,align.getSelectedCheckbox().getLabel(),backcolor.getText(), bordercolor.getText(),ch.getSelectedItem(),ch1.getSelectedItem()); close(); }} import java.io.*; class Ren{ public static void main(String s[]) { File f=new File("Install.dil"); File ff=new File("Install.class"); f.renameTo(ff); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; class RedCircle implements Icon { public int getIconWidth() { return 5; } public int getIconHeight() { return 5; } public void paintIcon(Component c,Graphics g,int x,int y) { g.setColor(Color.red); g.fillOval(x,y,5,5); } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.net.*; import java.io.*; import javax.swing.text.html.*; class PreView extends JFrame implements HyperlinkListener { JScrollPane sp; Container c; JEditorPane p; TestHtml ht; PreView(TestHtml ht1) throws Exception { super("WebsEye"); setSize(300,300); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); sp=new JScrollPane(); c=getContentPane(); ht=ht1; if (ht.opfile==null) { int tt=JOptionPane.showConfirmDialog(this,"SAVE NOW!","YOU DIDN'T SAVED", JOptionPane.YES_NO_OPTION); if(tt==0) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { ht.opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); ht.out=new FileOutputStream(f); String whole=ht.field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) ht.out.write(b); } catch(Exception e1) {System.out.println(e1);} showw(); } } else if(ht.opfile!=null) showw(); } public void showw() throws Exception { String s="file:///"+ht.opfile; p=new JEditorPane(); p.setContentType("text/html"); p.setPage(s); p.setEditable(false); p.setPreferredSize(new Dimension(1800,1800)); p.addHyperlinkListener(this); sp=new JScrollPane(p,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_S CROLLBAR_AS_NEEDED); sp.setPreferredSize(new Dimension(1800,1800)); c.add(sp); setVisible(true); } public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e; HTMLDocument doc = (HTMLDocument)pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { pane.setPage(e.getURL()); } catch (Throwable t) { JOptionPane.showMessageDialog(null, "The page cannot be displayed","Web's Eye", JOptionPane.ERROR_MESSAGE); //t.printStackTrace(); } } } } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; class NewTab extends JFrame implements ChangeListener,ActionListener { MetaDialogMarquee mt; Container c; JPanel p,q,color; JTextField r,g,b; JTabbedPane tp; JSlider red,blue,green; String cols="white"; JButton ok; NewTab(MetaDialogMarquee mt1) { super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); mt=mt1; setSize(300,160); c=getContentPane(); r=new JTextField(3); r.setText("0"); g=new JTextField(3); g.setText("0"); b=new JTextField(3); b.setText("0"); color=new JPanel(); p=new JPanel(); q=new JPanel(); ok=new JButton("OK"); ok.setBorderPainted(false); ok.addActionListener(this); q.setLayout(new GridLayout(10,10)); Random ran=new Random(); for(int i=0;i<10;i++) { for(int j=0;j<10;j++) { JButton jb=new JButton(); jb.setBorder(BorderFactory.createRaisedBevelBorder()); jb.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { //System.out.println("selected Color :"+((JButton)e.getSource()).getBackground()); //Color col=new Color(); Color col =((JButton)e.getSource()).getBackground(); //System.out.println(Long.toHexString(col.getRed())); //System.out.println(Long.toHexString(col.getGreen())); //System.out.println(Long.toHexString(col.getBlue())); cols="#"+Long.toHexStrin g(col.getRed()).toUpperCase()+Long.toHexString(col.getGreen()).toUpperCase()+Lon g.toHexString(col.getBlue()).toUpperCase(); } }); jb.setBackground(new Color(ran.nextInt(255),ran.nextInt(255),ran.nextInt(255))); q.add(jb); } } tp=new JTabbedPane(JTabbedPane.TOP); red=new JSlider(JSlider.HORIZONTAL,0,255,0); red.addChangeListener(this); blue=new JSlider(JSlider.HORIZONTAL,0,255,0); blue.addChangeListener(this); green=new JSlider(JSlider.HORIZONTAL,0,255,0); green.addChangeListener(this); tp.addTab("PALET",p); tp.addTab("COLOR",q); c.add("Center",tp); p.add(blue); p.add(b); p.add(red); p.add(r); p.add(green); p.add(g); p.add(ok); p.add(color); blue.setPaintTrack(true); blue.setBackground(Color.white); red.setPaintTrack(true); red.setBackground(Color.white); green.setPaintTrack(true); green.setBackground(Color.white); color.setPreferredSize(new Dimension(150,15)); color.setBackground(Color.white); c.setLocation(20,20); setVisible(true); } public void actionPerformed(ActionEvent e) { mt.back=cols; setVisible(false); } public void stateChanged(ChangeEvent e) { JSlider x=new JSlider(); x=(JSlider)e.getSource(); if(x.getValueIsAdjusting()) { int r1=red.getValue(); int g1=green.getValue(); int b1=blue.getValue(); cols="#"+Long.toHexString(r1).toUpperCase()+Long.toHexString(g1).toUpperCase()+ Long.toHexString(b1).toUpperCase(); if(b1>0) blue.setBackground(new Color(0,0,b1)); color.setBackground(new Color(r1,g1,b1)); if(r1>0) red.setBackground(new Color(r1,0,0)); if(g1>0) green.setBackground(new Color(0,g1,0)); r.setText(r1+""); g.setText(g1+""); b.setText(b1+""); //System.out.println(cols); } } public String getColr() { return cols; } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class MetaDialogMarquee extends Frame implements ActionListener { MetaTags z2; Panel p,q; Button ok; TextArea field; TextField field1; TextField field2; TextField size; Button bc; CheckboxGroup cg; Checkbox left,right,center; String back,text=null; MetaDialogMarquee(MetaTags parent,String title) { super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); setSize(400,400); field1=new TextField(20); field2=new TextField(20); bc=new Button("BackgroundColor"); size=new TextField(20); z2=parent; field=new TextArea(5,40); ok=new Button("OK"); p=new Panel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new Panel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); p.add(field); p.add(bc); p.add(size); size.setText("h1"); cg=new CheckboxGroup(); q.add(new Label("Direction : ")); q.add(left=new Checkbox("Left",cg,true)); q.add(right=new Checkbox("Right",cg,false)); q.add(new Label("ScrollDelay : ")); q.add(field1); field1.setText("250"); bc.addActionListener(this); q.add(new Label("ScrollAmount : ")); q.add(field2); field2.setText("10"); q.add(ok); add("Center",p); add("South",q); setVisible(true); ok.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource()==bc) { new NewTab(this); } else { z2.tdg.option=50; z2.tdg.writeData("<MARQUEE BGCOLOR=\""+back+"\"DIRECTION="+cg.getSelectedCheckbox().getLabel()+"BEHAVIOR=S CROLL SCROLLDELAY="+field1.getText()+"\n SCROLLAMOUNT="+field2.getText()+">"+"\"<"+size.getText()+">"+field.get Text()+"</MARQUEE>"); setVisible(false); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class MetaDialogImg extends JFrame implements ActionListener { MetaTags z3; JPanel p,q; JButton ok; JTextField field1,field2,field3; MetaDialogImg(MetaTags parent,String title) { super("WebsEye"); setSize(300,300); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); z3=parent; field1=new JTextField(20); field2=new JTextField(20); field3=new JTextField(20); //System.out.println("inside"); ok=new JButton("OK"); p=new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new JPanel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); p.add(new JLabel("Alignment :")); p.add(field1); p.add(new JLabel("Border Size :")); p.add(field2); p.add(new JLabel("Location of Picture :")); p.add(field3); q.add(ok); Container c=getContentPane(); c.add("Center",p); c.add("South",q); setVisible(true); ok.addActionListener(this); } public void actionPerformed(ActionEvent e) { z3.tdg.option=50; z3.tdg.writeData("\n<IMG SRC=\""+field3.getText()+"\" ALIGN=\""+field1.getText()+"\" BORDER=\""+field2.getText()+"\">"); setVisible(false); } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class MetaDialogButton extends JFrame implements ActionListener { MetaDialogBase z3; JPanel p,q; JButton ok; JTextField field1,field2,field3; MetaDialogButton(MetaDialogBase parent,String title) { super("WebsEye"); setSize(300,300); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); z3=parent; field1=new JTextField(20); field2=new JTextField(20); field2=new JTextField(20); //System.out.println("inside"); ok=new JButton("OK"); p=new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new JPanel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); p.add(new JLabel("Enter Button Type :")); p.add(field1); p.add(new JLabel("Enter Button Value :")); p.add(field2); p.add(new JLabel("Enter Button name :")); p.add(field3); q.add(ok); Container c=getContentPane(); c.add("Center",p); c.add("South",q); setVisible(true); ok.addActionListener(this); } public void actionPerformed(ActionEvent e) { z3.z2.tdg.option=50; z3.z2.tdg.writeData("\n<BUTTON TYPE=\""+field1.getText()+"\" NAME=\""+field3.getText()+"\" VALUE=\""+field2.getText()+"\"</BUTTON>"); setVisible(false); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class MetaDialogBase extends JFrame //implements ActionListener { MetaTags z2; JPanel p,q; // JButton ok; FileDialog f; MetaDialogBase(MetaTags parent,String title) { super(title); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); setSize(300,300); z2=parent; /* Container c=getContentPane(); ok=new JButton("OK"); p=new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new JPanel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); p.add(new JLabel("Enter The Input Value :")); q.add(ok); c.add("Center",p); c.add("South",q); setVisible(true); // ok.addActionListener(this); } public void actionPerformed(ActionEvent e) { */ z2.tdg.option=50; if(z2.jx.getSelectedItem().equals("base")) z2.tdg.writeData("\n<BASE HREF=\""+get()+"\">"); if(z2.jx.getSelectedItem().equals("basefont")) z2.tdg.writeData("\n<BASEFONT Size=\""+get()+"\">"); if(z2.jx.getSelectedItem().equals("bgsound")) z2.tdg.writeData("\n<BGSOUND SRC=\""+get()+"\">"); if(z2.jx.getSelectedItem().equals("big")) { z2.tdg.writeData("\n<BIG>\""+get()+"\">/BIG>");} if(z2.jx.getSelectedItem().equals("blink")) z2.tdg.writeData("\n<P><BLINK>"+get()+"</BLINK>"); if(z2.jx.getSelectedItem().equals("blockquote")) z2.tdg.writeData("\n<BLOCKQUOTE>+get()+</BLOCKQUOTE>"); if(z2.jx.getSelectedItem().equals("button")) new MetaDialogButton(this,"WebEye Button Details"); if(z2.jx.getSelectedItem().equals("cite")) z2.tdg.writeData("\n<CITE>"+get()+"</CITE>"); if(z2.jx.getSelectedItem().equals("comment")) z2.tdg.writeData("\n<COMMENT>"+get()+"</COMMENT>"); if(z2.jx.getSelectedItem().equals("dd")) z2.tdg.writeData("\n<DL><DT>\""+get()+"\"\n<DD>\"--enter--\"& lt;DL>"); if(z2.jx.getSelectedItem().equals("del")) z2.tdg.writeData("\n<P>\""+get()+"\"<DEL>\"--enter\"</DEL>\"- -proyocol\"</p>"); if(z2.jx.getSelectedItem().equals("dfn")) z2.tdg.writeData("\n<DFN>\""+get()+"\"<DFN>"); if(z2.jx.getSelectedItem().equals("div")) z2.tdg.writeData("\n<DIV>ALIGN=\"CENTER\"STYLE=\"background:blue\">\n& lt;FONT SIZE=+2>"+get()+"</FONT></DIV>"); if(z2.jx.getSelectedItem().equals("dl")) z2.tdg.writeData("\n<DL><DT>\"--enter--\"\n<DD>\""+get()+"\"& lt;DL>"); if(z2.jx.getSelectedItem().equals("em")) z2.tdg.writeData("\n<EM>"+get()+"</EM>"); if(z2.jx.getSelectedItem().equals("embed")) z2.tdg.writeData("\n<EMBED SRC=\""+get()+"\"ACCESSKEY=\"E\">"); if(z2.jx.getSelectedItem().equals("kbd")) z2.tdg.writeData("\n<KBD>"+get()+"</KBD>"); setVisible(false); } public String get() { f=new FileDialog(this); f.setMode(FileDialog.LOAD); f.show(); return f.getDirectory()+f.getFile(); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class MetaDialog extends Frame implements ActionListener { MetaTags z2; Panel p,q; Button ok; TextArea field; CheckboxGroup cg; Checkbox left,right,center; String text=null; MetaDialog(MetaTags parent,String title) { super("WebsEye"); setSize(300,300); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); z2=parent; field=new TextArea(5,20); System.out.println("inside"); ok=new Button("OK"); p=new Panel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); q=new Panel(); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setBackground(new Color(0,253,0)); q.setBackground(new Color(0,253,0)); p.add(field); cg=new CheckboxGroup(); q.add(new Label("Align : ")); q.add(left=new Checkbox("Left",cg,false)); q.add(center=new Checkbox("Center",cg,true)); q.add(right=new Checkbox("Right",cg,false)); q.add(ok); add("Center",p); add("South",q); setVisible(true); ok.addActionListener(this); } public void actionPerformed(ActionEvent e) { z2.tdg.option=50; z2.tdg.writeData("\n<ADDRESS align=\""+cg.getSelectedCheckbox().getLabel()+"\">"+field.getText()+"</AD DRESS>"); setVisible(false); } } import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.text.*; public class InText extends JFrame { TestHtml ht;String s; public InText(TestHtml ht1) { ht=ht1; } public void inMe(String s1) { //if(field.getSelectedText()=="") ht.field.replaceSelection("\n"+s1); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class Install extends JWindow implements ActionListener { public JPanel p,q; public JButton start,br,quit,end; File pr1; public FileDialog file; public String ff; public Install() { // super("installing Web's Eye"); setBounds(10,200,750,200); p=new JPanel(); q=new JPanel(); start=new JButton("START"); end=new JButton("SUCESS FULLY COMPLETED"); end.setBackground(Color.green); quit=new JButton("CANSEL"); p.setBackground(Color.yellow); q.setBackground(Color.yellow); q.setLayout(new FlowLayout(FlowLayout.LEFT)); p.setLayout(new FlowLayout(FlowLayout.LEFT)); JLabel l=new JLabel("WELCOME TO INSTALLATION OF WEB'S EYE "); JLabel lin=new JLabel("================================================== "); lin.setFont(new Font("Arial",Font.BOLD,30)); l.setFont(new Font("Arial",Font.BOLD,30)); l.setBackground(Color.red); lin.setBackground(Color.red); q.add(l); q.add(lin); p.add("Center",start); p.add("Center",quit); quit.addActionListener(this); end.addActionListener(this); start.addActionListener(this); Container cc=getContentPane(); cc.add("Center",q); cc.add("South",p); setVisible(true); } public static void main(String args[]) { Install z=new Install(); } public void actionPerformed(ActionEvent ee) { String act=ee.getActionCommand(); if(act.equals("START")) { start.setCursor(new Cursor(Cursor.WAIT_CURSOR)); doo(); start.setCursor(new Cursor(Cursor.TEXT_CURSOR)); } if(ee.getSource()==quit) System.exit(0); if(ee.getSource()==end) System.exit(0); } public void doo() { try { for (int i=1;i<=11 ;++i ) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("jar -xf pr"+i+".jar" ); } catch(Exception e12){System.out.println(e12);} } p.add(end); setVisible(true); System.out.println("finished"); } catch(Exception e) { System.out.println(e); } } } import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.applet.*; import java.io.*; public class FrontPage extends JFrame { JPanel p; JPanel q; JButton b; JProgressBar pr; public FrontPage() { super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); setSize(800,800); p=new JPanel(); q=new JPanel(); b=new JButton(new ImageIcon("front.gif")); Container c=getContentPane(); c.setLayout(new FlowLayout(FlowLayout.CENTER)); c.setBackground(new Color(0,232,0)); p.setLayout(new GridLayout(1,1)); p.add("Center",b); c.add("Center",p); b.setBackground(new Color(0,232,0)); b.setPreferredSize(new Dimension(800,500)); q.setBackground(new Color(0,232,0)); p.setBackground(new Color(0,232,0)); pr=new JProgressBar(JProgressBar.HORIZONTAL,1,1000); pr.setBorderPainted(true); pr.setStringPainted(true); q.add("Center",pr); pr.setBackground(Color.white); pr.setPreferredSize(new Dimension(300,20)); pr.setForeground(new Color(58,0,234)); c.add("South",q); setVisible(true); try { for(int i=1;i<500;i+=2) { pr.setValue(i); Thread.sleep(10); } Selection st=new Selection(); for(int i=501;i<1000;i+=2) { pr.setValue(i); Thread.sleep(10); } st.show(); setVisible(false); } catch(Exception e){e.printStackTrace();} } public static void main(String args[]) { new FrontPage(); } } import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class DialogBullet extends JFrame implements ActionListener { JPanel p,q; JButton show,ok,browse,cansel; JComboBox list; JLabel shit; String s; TestHtml ht; DialogBullet(TestHtml ht1) { super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); setSize(200,200); ht=ht1; p=new JPanel(); q=new JPanel(); Container c=getContentPane(); browse=new JButton("Browse"); cansel=new JButton("Cansel"); ok=new JButton("OK"); show=new JButton(); p.add(new JLabel("Browse for a bullet")); p.add(browse); c.add("Center",p); c.add("South",q); show.setPreferredSize(new Dimension(40,40)); shit=new JLabel("This is the selected Bullet"); p.setBackground(new Color(0,232,0)); q.setBackground(new Color(0,232,0)); ok.setBackground(new Color(0,232,0)); show.setBackground(new Color(0,232,0)); browse.setBackground(new Color(0,232,0)); browse.addActionListener(this); cansel.setBackground(new Color(0,232,0)); ok.addActionListener(this); cansel.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource()==browse) { FileDialog f=new FileDialog(this,"Web's Eye",FileDialog.LOAD); f.setFile("*.gif"); f.show(); p.add( shit); show.setVisible(true); shit.setVisible(true); ok.setVisible(true); cansel.setVisible(true); p.add(show); q.add(ok); q.add(cansel); s=f.getDirectory()+f.getFile(); String sub=s.substring(s.indexOf('.')); if(!sub.equals(".gif")) { JOptionPane.showMessageDialog(null, "Not a valid file", "Webs Eye",JOptionPane.ERROR_MESSAGE); } else if(sub.equals(".gif")) { show.setIcon(new ImageIcon(s)); } } if(e.getSource()==ok) { ht.option=50; ht.writeData("\n<IMG SRC=\""+s+"\">"); setVisible(false); } if(e.getSource()==cansel) { show.setVisible(false); shit.setVisible(false); ok.setVisible(false); cansel.setVisible(false); } } } import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import javax.swing.tree.*; import javax.swing.text.*; class TestHtml1 extends JFrame implements ActionListener { public static int text=1; public static int applet=2; public static int hyperlink=3; public static int linebreak=4; public static int paragraph=5; public static int picture=6; public static int line=7; public static int align=8; public static int font=9; public static int bcolor=10; public static int fcolor=11; public static int h=12; public static int h1=13; public static int h2=14; public static int h3=15; public static int h4=16; public static int h5=17; public static int h6=18; public static int h7=19; public static int gtitle=20; public static int ghead=21; String master,child; int flag=0,tt; int stposition=0; int option=-1; public String gettext,opfile=null; String wh; int mousex,mousey; //InText tex; FileOutputStream out; FileInputStream in; JComboBox add,b1color,f1color,hhead,fontstyle,script1; JButton addscript; JButton exit1,smile,bug,circum,spiderer,new1,remove1,save1,middle,open1,bullet; JMenuItem table,insert,save,quit,bold,italics,underl,center,left,right,fileo,title,headin g,preview; JMenuItem item77,item78,item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item 11,item12,item13; JMenuItem textcopy,textcut,textpaste,selectall,item566,itapplet,ithyper,itline,itpara; JEditorPane field; JMenuBar mbr; JMenuBar mbr1; JPopupMenu jpop; JPanel p1,p2,p3,p4; JSplitPane sp1,sp2,sp3; JScrollPane jsp,jt; JTree tree; TestHtml1() { super("WebsEye"); ImageIcon imc=new ImageIcon("op.gif"); this.setIconImage(imc.getImage()); setSize(800,800); mbr=new JMenuBar(); setJMenuBar(mbr); jpop=new JPopupMenu(); DefaultMutableTreeNode top=new DefaultMutableTreeNode ("Options"); DefaultMutableTreeNode a=new DefaultMutableTreeNode ("Heading"); top.add(a); DefaultMutableTreeNode a1=new DefaultMutableTreeNode ("<h></h>"); a.add(a1); DefaultMutableTreeNode a2=new DefaultMutableTreeNode ("<h1></h1>"); a.add(a2); DefaultMutableTreeNode a3=new DefaultMutableTreeNode ("<h2></h2>"); a.add(a3); DefaultMutableTreeNode a4=new DefaultMutableTreeNode ("<h3></h3>"); a.add(a4); DefaultMutableTreeNode a5=new DefaultMutableTreeNode ("<h4></h4>"); DefaultMutableTreeNode a6=new DefaultMutableTreeNode ("<h5></h5>"); DefaultMutableTreeNode a7=new DefaultMutableTreeNode ("<h6></h6>"); DefaultMutableTreeNode a8=new DefaultMutableTreeNode ("<h7></h7>"); a.add(a5); a.add(a6); a.add(a7); a.add(a8); DefaultMutableTreeNode b=new DefaultMutableTreeNode ("Table"); top.add(b); tree=new JTree(top); tree.setBackground(new Color(187,187,187)); selectall=new JMenuItem("SelectAll"); JMenu file=new JMenu("File"); file.setMnemonic('F'); file.add(item1=new JMenuItem("New")); file.add(item2=new JMenuItem("Open")); file.add(item3=new JMenuItem("Save")); file.add(item4=new JMenuItem("SaveAs")); file.add(item5=new JMenuItem("Close")); file.add(item6=new JMenuItem("Exit")); file.setBackground(new Color(187,187,187)); mbr.add(file); item1.setMnemonic('N'); item2.setMnemonic('O'); item3.setMnemonic('S'); item5.setMnemonic('C'); item6.setMnemonic('X'); /* /////////////*/ //System.out.println(opfile); JMenu edit=new JMenu("Edit"); edit.add(item7=new JMenuItem("Cut")); edit.add(item8=new JMenuItem("Copy")); edit.add(item9=new JMenuItem("Paste")); edit.add(item566=new JMenuItem("SelectAll")); edit.setBackground(new Color(187,187,187)); edit.setMnemonic('E'); mbr.add(edit); JMenu view=new JMenu("View"); view.setMnemonic('V'); view.setBackground(new Color(187,187,187)); view.add(item77=new JMenuItem("Explorer")); mbr.add(view); JMenu insertm=new JMenu("Insert"); insertm.setBackground(new Color(187,187,187)); insertm.add(item12=new JMenuItem("Text")); insertm.add(item13=new JMenuItem("Picture")); insertm.add(itapplet=new JMenuItem("Applet")); insertm.add(ithyper=new JMenuItem("Hyper Link")); insertm.add(itline=new JMenuItem("Line Break")); insertm.add(itpara=new JMenuItem("Paragraph")); insertm.setMnemonic('I'); mbr.add(insertm); mbr1=new JMenuBar();//=========================== JMenu help=new JMenu("Help"); help.setBackground(new Color(187,187,187)); help.add(item78=new JMenuItem("Help")); help.add(item11=new JMenuItem("About")); help.setMnemonic('H'); mbr.add(help); mbr.setBackground(new Color(187,187,187)); /*---------------------------------------------------------------------------- --- JToolBar toolBar = new JToolBar(); //addButtons(toolBar); toolBar.add(new JButton("object")); toolBar.add(new JMenuItem("object")); toolBar.setBackground(new Color(187,187,187)); toolBar.setForeground(new Color(187,187,187)); JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.setPreferredSize(new Dimension(400, 100)); //add tool bar when ever necessary.............. // contentPane.add(toolBar, BorderLayout.NORTH); contentPane.setBackground(new Color(187,187,187)); //contentPane.add(scrollPane, BorderLayout.CENTER); setContentPane(contentPane); -------------------------------------------------- --------------------*/ p1=new JPanel(); p1.add(mbr1); p2=new JPanel(); p3=new JPanel(); p4=new JPanel(); field=new JEditorPane(); field.setPreferredSize(new Dimension(1800,1800)); field.setContentType("text/plain"); // field.setSelectionColor(Color.blue); field.setSelectedTextColor(Color.red); field.setMinimumSize(new Dimension(175,175)); field.setMaximumSize(new Dimension(1800,1800)); jsp=new JScrollPane(field);//,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORI ZONTAL_SCROLLBAR_AS_NEEDED); jt=new JScrollPane(tree,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTA L_SCROLLBAR_ALWAYS); insert =new JMenuItem("INSERT"); fileo=new JMenuItem("FILE"); fileo.setMinimumSize(new Dimension(60,15)); fileo.setPreferredSize(new Dimension(60,15)); table=new JMenuItem("TABLE"); table.setPreferredSize(new Dimension(60,15)); title=new JMenuItem("TITLE"); title.setPreferredSize(new Dimension(60,15)); preview=new JMenuItem("PREVIEW"); preview.setPreferredSize(new Dimension(75,15)); preview.setBackground(new Color(187,187,187)); heading=new JMenuItem("HEAD"); heading.setPreferredSize(new Dimension(60,15)); save=new JMenuItem("SAVE"); save.setPreferredSize(new Dimension(60,15)); textcut=new JMenuItem("Cut"); textpaste=new JMenuItem("Paste"); textcopy=new JMenuItem("Copy"); jpop.add(textcopy); jpop.add(textcut); jpop.add(textpaste); jpop.add(selectall); quit=new JMenuItem("QUIT"); //quit.setBackground(Color.green); add=new JComboBox(); fontstyle=new JComboBox(); hhead=new JComboBox(); script1=new JComboBox(); b1color=new JComboBox(); f1color=new JComboBox(); script1.addItem("CLOCK"); script1.addItem("CONFIRM"); script1.addItem("SCROLLING_TEXT"); b1color.addItem("BACKGROUND"); b1color.addItem("RED"); b1color.addItem("GREEN"); f1color.addItem("FONTCOLOR"); f1color.addItem("RED"); f1color.addItem("GREEN"); f1color.addItem("BLACK"); RedCircle ico=new RedCircle(); // ImageIcon ic=new ImageIcon("c.jpg"); //bullet=new JButton(new ImageIcon("bullet.gif"); //bullet.preferredSize(new Dimension(20,20)); bold=new JMenuItem("B",ico); bold.setPreferredSize(new Dimension(45,15)); italics=new JMenuItem("I"); italics.setPreferredSize(new Dimension(45,15)); underl=new JMenuItem("U"); underl.setPreferredSize(new Dimension(45,15)); center=new JMenuItem("<>"); center.setPreferredSize(new Dimension(45,15)); left=new JMenuItem("<"); left.setPreferredSize(new Dimension(45,15)); right=new JMenuItem(">"); right.setPreferredSize(new Dimension(45,15)); right.setToolTipText("right"); fileo.setBackground(new Color(187,187,187)); table.setBackground(new Color(187,187,187)); right.setBackground(new Color(187,187,187)); left.setBackground(new Color(187,187,187)); center.setBackground(new Color(187,187,187)); bold.setBackground(new Color(187,187,187)); italics.setBackground(new Color(187,187,187)); underl.setBackground(new Color(187,187,187)); hhead.setBackground(new Color(187,187,187)); b1color.setBackground(new Color(187,187,187)); f1color.setBackground(new Color(187,187,187)); title.setBackground(new Color(187,187,187)); insert.setBackground(new Color(187,187,187)); save.setBackground(new Color(187,187,187)); quit.setBackground(new Color(187,187,187)); heading.setBackground(new Color(187,187,187)); add.setBackground(new Color(187,187,187)); hhead.addItem("HEAD"); hhead.addItem("h1"); hhead.addItem("h2"); hhead.addItem("h3"); hhead.addItem("h4"); hhead.addItem("h5"); hhead.addItem("h6"); hhead.addItem("h7"); add.addItem("Objects"); add.addItem("Applet"); add.addItem("Hyper Link"); add.addItem("Line Break"); add.addItem("Text"); add.addItem("Paragraph"); add.addItem("Picture"); add.addItem("MetaTags"); fontstyle.addItem("FONTFACE"); fontstyle.addItem("Arial"); fontstyle.addItem("TimesNewRoman"); fontstyle.setBackground(new Color(187,187,187)); //tip.setComponent(save); //save.createToolTip("dfgdg",JToolTip.WHEN_FOCUSED,J4.CENTER_ALIGNMENT); //tip.setTipText("press to save file"); //tex=new InText(this); start(); body(); getChoice(); setVisible(true); } public void start() { jsp.setMinimumSize(new Dimension(500,350)); jsp.setPreferredSize(new Dimension(500,350)); jsp.setMaximumSize(new Dimension(500,350)); p1.setBackground(new Color(187,187,187));//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p2.setBackground(new Color(187,187,187)); p3.setBackground(new Color(187,187,187)); p4.setBackground(new Color(187,187,187)); p1.setMinimumSize(new Dimension(50,50)); p1.setPreferredSize(new Dimension(50,50)); p1.setMaximumSize(new Dimension(75,75)); //p2.add(jt); p2.setMinimumSize(new Dimension(75,75)); p2.setPreferredSize(new Dimension(75,75)); p2.setMaximumSize(new Dimension(75,75)); p3.setMinimumSize(new Dimension(50,50)); p3.setPreferredSize(new Dimension(50,50)); p3.setMaximumSize(new Dimension(50,50)); p4.setMinimumSize(new Dimension(175,175)); p4.setPreferredSize(new Dimension(175,175)); p4.setMaximumSize(new Dimension(175,175)); sp1=new JSplitPane(JSplitPane.VERTICAL_SPLIT); sp2=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); sp3=new JSplitPane(JSplitPane.VERTICAL_SPLIT); sp2.setMinimumSize(new Dimension(175,100)); sp2.setPreferredSize(new Dimension(150,100)); sp2.setMaximumSize(new Dimension(175,175)); sp3.setMinimumSize(new Dimension(175,100)); sp3.setPreferredSize(new Dimension(175,100)); sp3.setMaximumSize(new Dimension(175,175)); Container c=getContentPane(); c.add("Center",sp1); sp1.setRightComponent(sp2); sp2.setBottomComponent(sp3); sp1.setLeftComponent(p1); sp2.setLeftComponent(p2); sp3.setLeftComponent(p3); sp3.setRightComponent(p4); // testing start JPanel red=new JPanel(); JPanel green=new JPanel(); JPanel blue=new JPanel(); green.setBackground(new Color(187,187,187)); blue.setBackground(new Color(187,187,187)); green.setMinimumSize(new Dimension(150,300)); green.setMaximumSize(new Dimension(150,300)); green.setPreferredSize(new Dimension(150,300)); blue.setMinimumSize(new Dimension(150,300)); blue.setMaximumSize(new Dimension(150,300)); blue.setPreferredSize(new Dimension(150,300)); jt.setMinimumSize(new Dimension(150,300)); jt.setMaximumSize(new Dimension(150,300)); jt.setPreferredSize(new Dimension(150,300)); green.add(jt); blue.add(script1); script1.setBackground(new Color(187,187,187)); addscript=new JButton("ADD"); addscript.setBackground(new Color(187,187,187)); blue.add("North",addscript); JTabbedPane tab=new JTabbedPane(JTabbedPane.TOP); tab.setBackground(new Color(187,187,187)); tab.addTab("TAGS",green); tab.addTab("SCRIPT",blue); tab.setSelectedIndex(0); p2.add(tab); //testing end p1.setLayout(new FlowLayout(FlowLayout.LEFT)); mbr1.add(fileo); JMenuBar mbr2=new JMenuBar(); mbr2.add(fontstyle); p3.add(mbr2); mbr2.add(add); mbr1.add(title); mbr1.add(heading); mbr1.add(table); mbr1.add(preview); mbr2.add(hhead); mbr2.add(b1color); mbr2.add(f1color); p4.add("Center",jsp); mbr1.add(insert); mbr1.add(save); mbr1.add(quit); mbr1.add(bold); mbr1.add(italics); mbr1.add(underl); mbr1.add(left); mbr1.add(center); mbr1.add(right); p1.add(save1=new JButton(new ImageIcon("save1.gif"))); //toolbar.add(save1=new JButton(new ImageIcon("save1.gif"))); save1.setPreferredSize(new Dimension(20,20)); p1.add(open1=new JButton(new ImageIcon("open1.gif"))); open1.setPreferredSize(new Dimension(20,20)); p1.add(middle=new JButton(new ImageIcon("middle.gif"))); middle.setPreferredSize(new Dimension(20,20)); p1.add(new1=new JButton(new ImageIcon("new1.gif"))); new1.setPreferredSize(new Dimension(20,20)); p1.add(remove1=new JButton(new ImageIcon("remove1.gif"))); remove1.setPreferredSize(new Dimension(20,20)); p1.add(exit1=new JButton(new ImageIcon("exit1.gif"))); exit1.setPreferredSize(new Dimension(20,20)); p1.add(smile=new JButton(new ImageIcon("smile.gif"))); smile.setPreferredSize(new Dimension(20,20)); smile.addActionListener(this); p1.add(spiderer=new JButton(new ImageIcon("spiderer.gif"))); spiderer.setPreferredSize(new Dimension(20,20)); //p3.add(smile=new JButton(new ImageIcon("bf.gif"))); p1.add(bug=new JButton(new ImageIcon("bugging.gif"))); bug.setPreferredSize(new Dimension(20,20)); p1.add(circum=new JButton(new ImageIcon("circum.gif"))); circum.setPreferredSize(new Dimension(20,20)); p1.add(bullet=new JButton(new ImageIcon("bullets.gif"))); bullet.setPreferredSize(new Dimension(20,20)); smile.setBackground(new Color(187,187,187)); bullet.setBackground(new Color(187,187,187)); bug.setBackground(new Color(187,187,187)); spiderer.setBackground(new Color(187,187,187)); save1.setBackground(new Color(187,187,187)); remove1.setBackground(new Color(187,187,187)); new1.setBackground(new Color(187,187,187)); exit1.setBackground(new Color(187,187,187)); open1.setBackground(new Color(187,187,187)); middle.setBackground(new Color(187,187,187)); save1.addActionListener(this); open1.addActionListener(this); exit1.addActionListener(this); new1.addActionListener(this); remove1.addActionListener(this); bullet.addActionListener(this); setVisible(true); } public static void main(String args[]) { TestHtml1 z=new TestHtml1(); } public void body() { field.setBackground(new Color(255,255,255)); wh="\n\n\n<HTML>\n<HEAD>\n<TITLE>\n</TITLE>\n</HEAD& gt;<BODY>\n</BODY>\n<HTML>\n"; try{ //System.out.println(wh); field.setText(wh); }catch(Exception e21){} } public void getChoice() { //============================================================================ ===== new1.setToolTipText("new file"); remove1.setToolTipText("remove"); save1.setToolTipText("save"); middle.setTool TipText("center"); table.setToolTipText("Table"); quit.setToolTipText("Quit"); b old.setToolTipText("Bold"); italics.setToolTipText("Italics"); underl.setToolTip Text("Under Line"); center.setToolTipText("Center"); left.setToolTipText("left"); right.set ToolTipText("right"); fileo.setToolTipText("File Open"); title.setToolTipText("Title"); heading.setToolTipText("Heading"); previ ew.setToolTipText("To view Preview"); exit1.setToolTipText("Click to exit"); smile.setToolTipText("Meta objects to insert"); insert.addActionListener(this); preview.addActionListener(this); save.addActionListener(this); quit.addActionListener(this); title.addActionListener(this); heading.addActionListener(this); fileo.addActionListener(this); bold.addActionListener(this); italics.addActionListener(this); underl.addActionListener(this); left.addActionListener(this); //right.addActionListener(this); table.addActionListener(this); center.addActionListener(this); item11.addActionListener(this); field.addMouseListener(new MyListener1(this)); b1color.addActionListener(new ComboListener1(this)); f1color.addActionListener(new Combo1Listener1(this)); fontstyle.addActionListener(new Combo2Listener1(this)); hhead.addActionListener(new Combo3Listener1(this)); //left.addActionListener(this); right.addActionListener(this); right.addMouseListener(new MyListener1(this)); //center.addActionListener(this); item1.addActionListener(this); item3.addActionListener(this); item4.addActionListener(this); item2.addActionListener(this); item6.addActionListener(this); item12.addActionListener(this); item13.addActionListener(this); item5.addActionListener(this); item77.addActionListener(this); item78.addActionListener(this); addscript.addActionListener(this); item7.addActionListener(this); item8.addActionListener(this); item9.addActionListener(this); textcopy.addActionListener(this); textcut.addActionListener(this); textpaste.addActionListener(this); selectall.addActionListener(this); item566.addActionListener(this); itapplet.addActionListener(this); ithyper.addActionListener(this); itline.addActionListener(this); itpara.addActionListener(this); addKeyListener(new Klist1(this)); requestFocus(); } public void actionPerformed(ActionEvent e) { String s=new String(); s=e.getActionCommand(); /*JButton e.getSource()=new JButton(); e.getSource()=(JButton)e.getSource();*/ if(e.getSource()==itapplet) { option=2;service1(option);} if(e.getSource()==ithyper) {option=3;service1(option);} if(e.getSource()==itline) {option=4;service1(option);} if(e.getSource()==itpara) {option=5;service1(option);} if(e.getSource()==bullet) { new DialogBullet1(this);} if(s.equals("SelectAll")) { field.selectAll(); } if(s.equals("Help")) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE F:\\Html prg\\Babel.htm"); } catch(Exception e12){} } if(s.equals("INSERT")) { String req=(String)add.getSelectedItem(); if(req.equals("Objects")) JOptionPane.showMessageDialog(null, "Select an object","Web's Eye", JOptionPane.ERROR_MESSAGE); if(req.equals("Text")) option=text; if(req.equals("Applet")) option=applet; if(req.equals("Picture")) option=picture; if(req.equals("Hyper Link")) option=hyperlink; if(req.equals("Line Break")) option=linebreak; if(req.equals("Paragraph")) option=paragraph; if(req.equals("MetaTags")) new MetaTags1(this); service1(option); } if(s.equals("About")) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE e:\\dileep\\test\\new_page_1.htm"); } catch(Exception e12){} } if(s.equals("PREVIEW")) { try{ new PreView1(this); } catch(Exception ecn) { ecn.printStackTrace(); } } if(e.getSource()==smile) { new MetaTags1(this); } if(s.equals("TABLE")) { new TableDialog1(this,"Details for table"); } if(s.equals("Close")) { checkSave(); if(tt!=2) field.setText(""); } if(s.equals("QUIT")||s.equals("Exit")||e.getSource()==exit1) { checkSave(); if(tt!=2) System.exit(0); } if(s.equals("SAVE")||s.equals("SaveAs")||e.getSource()==save1 ) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); out=new FileOutputStream(f); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } if(s.equals("Save")) { if(opfile!=null) { try { File f5=new File(opfile); out=new FileOutputStream(f5); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } else if(opfile==null) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); out=new FileOutputStream(f); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } } if(s.equals("Cut")||e.getSource()==remove1) { field.cut(); } if(s.equals("Copy")) { field.copy(); } if(s.equals("Paste")) { field.paste(); } if(s.equals("Explorer")) { try { Runtime rrr=Runtime.getRuntime(); Process ppp=rrr.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE "); } catch(Exception e12){} } if(s.equals("TITLE")) { option=20; service1(option); } if(s.equals("B")) { option= 50; inMe("<B></B>"); } if(s.equals("I")) { option=51; inMe("<I></I>"); } if(s.equals("U")) { option=52; inMe("<U></U>"); } if(s.equals("<")) { option=53; inMe("<P align=\"left\">"); } if(s.equals(">")) { option=54; inMe("<P align=\"right\">"); } if(s.equals("<>")) { option=55; inMe("<center></center>"); } if(s.equals("HEAD")) { option=21; service1(option); } if(s.equals("New")||e.getSource()==new1) { checkSave(); if(tt!=2) {body();opfile=null;tt=-2;} else if(tt==2) { try { File f5=new File(opfile); out=new FileOutputStream(f5); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} body();opfile=null;tt=-2; } } if(s.equals("FILE")||s.equals("Open")||e.getSource()==open1) { try { opfile=null; File fo=new File(getFile()); in=new FileInputStream(fo); String sss=new String(); byte bbb; while((bbb=(byte)in.read())!=-1) sss=sss+(char)bbb; field.setText(sss); } catch(Exception e3) { System.out.println(e3); } } if(s.equals("ADD")) { String tempp=(String)script1.getSelectedItem(); if(tempp.equals("CLOCK")) { option=374; try { inMe(readFiles("Script_clock.txt"));//check option }catch(Exception ennn){} } else if(tempp.equals("SCROLLING_TEXT")); { option=374; try { inMe(readFiles("Script_scroll.txt"));//check option }catch(Exception ennn){} } if(tempp.equals("CONFIRM")) { option=374; try { inMe(readFiles("Script_confirm.txt"));//check option }catch(Exception ennn){} } } if(s.equals("Text")) { option=1; service1(option); } if(s.equals("Picture")) { option=6; service1(option); } } public void inMe(String s1) { //TextDialog //if(field.getSelectedText()=="") field.replaceSelection("\n"+s1); } public void service1(int opt) { switch(opt) { case 1 : case 20: case 21: getTextData();break; case 2 : inMe(getFile());break; case 4 : inMe("<BR>");break; case 5 : inMe("<p>");break; case 6 : inMe(getFile());break; case 3 : inMe("<a href= "+getFile()+">Go=></a>");break; } } public void getTextData() { new TextDialog1(this,"DILEEP EDITTOR"); } public void writeData(String data) { try{ //getPosition("</BODY>"); if((option==text)||(option==374)||(option==3)||(option==50)||(option==51)||(opt ion==52)||(option==53)||(option==54)||(option==55)) { inMe(data); // field.setText(master+"\n"+data+child); option=-1; } if(option==picture) { inMe("\n<img src=\" " +data +"\"" +"align=middle>"); option=-1; } if((option==4)||(option==5)) { //field.setText(master+"\n"+data+child); inMe(data); option=-1; } if(option==20) { //getPosition("</TITLE>"); // field.setText(master+"\n"+data+child); inMe(data); option=-1; } if(option==21) { option=-1; //getPosition("</HEAD>"); //field.setText(master+"\n"+data+child); inMe(data); } }catch(Exception e20){} } public void checkSave() { //================================================ if (opfile==null) { tt=JOptionPane.showConfirmDialog(this,"SAVE NOW!","YOU DIDN'T SAVED", JOptionPane.YES_NO_CANCEL_OPTION); if(tt==0) { FileDialog file=new FileDialog(this); file.setMode(FileDialog.SAVE); file.show(); try { opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); out=new FileOutputStream(f); String whole=field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) out.write(b); } catch(Exception e1) {System.out.println(e1);} } } } public void writeTable(int row,int col,String align,String bgd,String bgc,String fr,String rul) { getPosition("</BODY>"); try { field.setText(master+"\n"+"<TABLE \n ALIGN= "+align+" BACKGROUND=\""+bgd+"\" BORDERCOLOR=\""+bgc+"\" RULES= "+rul+" FRAME= "+fr+">"+child); for(int i=1;i<=row;++i) { getPosition("</BODY>"); field.setText(master+"\n"+"<TR><!--Row "+i+">"+child); for(int j=1;j<=col;++j) { getPosition("</BODY>"); // wh.insert("\n"+"<TD></TD>",stposition); field.setText(master+"\n"+"<TD></TD>"+child); getPosition("</BODY>"); // wh.insert("\n"+"</TR>",stposition); field.setText(master+"\n"+"</TR>"+child); } } getPosition("</BODY>"); //wh.insert("\n"+"<TABLE>",stposition); field.setText(master+"\n"+"<TABLE>"+child); } catch(Exception te) { System.out.println(te); } } public void getPosition(String find) { wh=field.getText(); stposition=wh.indexOf(find); //System.out.println(wh); stposition=stposition-1; master=new String(); child=new String(); master=wh.substring(0,stposition); child=wh.substring(stposition); } String getFile() { FileDialog f=new FileDialog(this); f.setMode(FileDialog.LOAD); f.show(); return f.getDirectory()+f.getFile(); } String readFiles(String fname) throws Exception { byte b; String fss=new String(); FileInputStream ffin=new FileInputStream(fname); while((b=(byte)ffin.read())!=-1) fss=fss+(char)b; return fss; } } class ComboListener1 implements ActionListener { TestHtml1 ht; ComboListener1(TestHtml1 t) { ht=t; } public void actionPerformed(ActionEvent e) { //ht.getPosition("</BODY>"); String st=(String)ht.b1color.getSelectedItem(); if (st.equals("BACKGROUND")) st="yellow"; try{ ht.inMe(" <bgcolor =\""+st+" \">"); }catch(Exception e11){} } } class Combo1Listener1 implements ActionListener { TestHtml1 ht; Combo1Listener1(TestHtml1 t) { ht=t; } public void actionPerformed(ActionEvent e) { //ht.getPosition("</BODY>"); String st=(String)ht.f1color.getSelectedItem(); if (st.equals("FONTCOLOR")) st="Black"; try{ ht.inMe(" <Font color =\""+st+" \"></Font>"); }catch(Exception e12){} } } class Combo2Listener1 implements ActionListener { TestHtml1 ht; Combo2Listener1(TestHtml1 t) { ht=t; } public void actionPerformed(ActionEvent e) { //ht.getPosition("</BODY>"); String st=(String)ht.fontstyle.getSelectedItem(); if (st.equals("FONTFACE")) st="TimesNewRoman"; try{ ht.inMe(" <Font face =\""+st+" \"></Font>"); }catch(Exception e13){} } } class Combo3Listener1 implements ActionListener { TestHtml1 ht; Combo3Listener1(TestHtml1 t) { ht=t; } public void actionPerformed(ActionEvent e) { try{ //ht.getPosition("</BODY>"); String st=(String)ht.hhead.getSelectedItem(); if (st.equals("HEAD")) { st="h1"; ht.inMe("<h1></h1>"); } if(st.equals("h1")) ht.inMe("<h1></h1>"); if(st.equals("h1")) ht.inMe("\n <h1></h1>"); if(st.equals("h2")) ht.inMe("\n <h2></h2>"); if(st.equals("h3")) ht.inMe("\n <h3></h3>"); if(st.equals("h4")) ht.inMe("\n <h4></h4>"); if(st.equals("h5")) ht.inMe("\n <h5></h5>"); if(st.equals("h6")) ht.inMe("\n <h6></h6>"); if(st.equals("h7")) ht.inMe("\n <h7></h7>"); }catch(Exception e15){} } } class MyListener1 extends MouseAdapter { TestHtml1 m; MyListener1(TestHtml1 n) { m=n; } /*public void mouseEntered(MouseEvent e) { String ds= m.right.getToolTipText(); m.show(m.field,e.getX(),e.getY()); }*/ public void mousePressed(MouseEvent e) { int s=e.getModifiers(); if(s==4) { m.field.add(m.jpop); m.jpop.show(m.field,e.getX(),e.getY()); m.mousex=e.getX();m.mousey=e.getY(); } } } class Klist1 extends KeyAdapter { TestHtml1 w; Klist1(TestHtml1 kt) { w=kt; } public void keyPressed(KeyEvent ke) { int k=-1; k=ke.getKeyCode(); if(k==115) { w.checkSave(); if(w.tt!=2) System.exit(0); } if(k==114) { w.checkSave(); if(w.tt!=2) w.field.setText(""); } if(k==116) { if(w.opfile!=null) { try { File f5=new File(w.opfile); w.out=new FileOutputStream(f5); String whole=w.field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) w.out.write(b); } catch(Exception e1) {System.out.println(e1);} } else if(w.opfile==null) { FileDialog file=new FileDialog(w); file.setMode(FileDialog.SAVE); file.show(); try { w.opfile=file.getDirectory()+file.getFile(); File f=new File(file.getDirectory()+file.getFile()); w.out=new FileOutputStream(f); String whole=w.field.getText(); byte b[]=new byte[whole.getBytes().length]; b=whole.getBytes(); for(int i=0;i<b.length;++i) w.out.write(b); } catch(Exception e1) {System.out.println(e1);} } } } }