Results 1 to 8 of 8
  1. #1
    Ashi is offline Member
    Join Date
    Jan 2012
    Location
    Pune ,Maharashtra
    Posts
    9
    Rep Power
    0

    Default how to provide language support?

    Hi

    I am facing 1 problem while making my own browser, When I am going to open url ,page gets opened but when I am going to click on any button on that particular page then it is not working. So I thought in this case we have to provide language support that other browser provides but I ave no idea about How to provide language support?

    Can you help me?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: how to provide language support?

    click on any button on that particular page then it is not working.
    Are you asking about how your program supports hyperlinks?

  3. #3
    Ashi is offline Member
    Join Date
    Jan 2012
    Location
    Pune ,Maharashtra
    Posts
    9
    Rep Power
    0

    Default Re: how to provide language support?

    yes,
    that is the problem.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: how to provide language support?

    I have no experience with them but I have heard of hyperlink listeners. Are you using them to catch the user's clicking on a link?

  5. #5
    Ashi is offline Member
    Join Date
    Jan 2012
    Location
    Pune ,Maharashtra
    Posts
    9
    Rep Power
    0

    Default Re: how to provide language support?

    Yes Sir, I am using hyperlinklisteners.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: how to provide language support?

    Is the listener called when the user clicks on a hyperlink?
    If so, what does your code do?

  7. #7
    Ashi is offline Member
    Join Date
    Jan 2012
    Location
    Pune ,Maharashtra
    Posts
    9
    Rep Power
    0

    Default Re: how to provide language support?

    Here is my Code, when I click on hyperlink the hyperlink gets called, but after that if I am going click on the button on that page the button is not responding.
    Here is my Code,
    Java Code:
    package urlpkg;
    import java.awt.*;
    import java.io.*;
    import java.awt.event.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.html.*;
    import javax.swing.undo.CannotUndoException;
    import javax.swing.undo.UndoManager;
    import javax.swing.JFrame;
    import java.io.File;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.FileFilter;
    import java.sql.*;
    
    public class Entry extends JFrame implements HyperlinkListener
    	{
    	
    	// These are the buttons for iterating through the page list.
    	private JButton backButton, forwardButton;
    	private JButton btn;
        JFileChooser c=new JFileChooser();   
    	 String filename;
    	// Page location text field.
    	private JTextField locationTextField;
    	private String user,pass;
    	private JLabel us,ps;
    	private JTextField tus;
    	private TextField tps;
    	private  JLabel em;
    	// Editor pane for displaying pages.
    	private JEditorPane displayEditorPane;
        private JPopupMenu popup=new JPopupMenu();
    	// Browser's list of pages that have been visited.
    	private ArrayList pageList = new ArrayList();
        private UndoAction undoAction=new UndoAction();
        private UndoManager undo=new UndoManager();
    	boolean opened=false;
    	// Constructor for Web Browser.
         public Entry()
         {
    		
    		setIconImage(Toolkit.getDefaultToolkit().getImage("d:\\logo.gif"));
    		
    	   
    	    // Handle closing events.
    	      addWindowListener(new WindowAdapter() {
    	    	  public void windowClosing(WindowEvent e) {
    	    		  actionExit();
    	    	  }
    	      });
    	      
    	     
    	   
    	  	
    	  	
    	  		// Set up file menu.
    	      JMenuBar menuBar = new JMenuBar();
    	      JMenu fileMenu = new JMenu("File");
    	      JMenu editMenu = new JMenu("Edit");
    	      JMenu viewMenu = new JMenu("View");
    	      //JMenu historyMenu = new JMenu("History");
    	      JMenu bookmarksMenu = new JMenu("Bookmarks");
    	      JMenu toolsMenu = new JMenu("Tools");
    	      JMenu helpsMenu = new JMenu("Helps");
    	     
    	      
    	     
    	      
    	      fileMenu.setMnemonic(KeyEvent.VK_F);
    	      editMenu.setMnemonic(KeyEvent.VK_E);
    	      viewMenu.setMnemonic(KeyEvent.VK_V);
    	      //historyMenu.setMnemonic(KeyEvent.VK_H);
    	      bookmarksMenu.setMnemonic(KeyEvent.VK_B);
    	      toolsMenu.setMnemonic(KeyEvent.VK_T);
    	      helpsMenu.setMnemonic(KeyEvent.VK_H);
    	
    	      JMenuItem New = new JMenuItem("New",KeyEvent.VK_N);
    	      JMenuItem Open = new JMenuItem("Open",KeyEvent.VK_O);
    	      JMenuItem Save = new JMenuItem("Save",KeyEvent.VK_S);
    	      JMenuItem SaveAs = new JMenuItem("Save As",KeyEvent.VK_A);
    	      JMenuItem Print = new JMenuItem("Print",KeyEvent.VK_P);
    	      JMenuItem Exitm = new JMenuItem("Exit",KeyEvent.VK_X);
    	      
    	      
    	      JMenuItem cut= new JMenuItem("Cut",KeyEvent.VK_U);
    	      JMenuItem copy= new JMenuItem("Copy",KeyEvent.VK_C);
    	      JMenuItem paste= new JMenuItem("Paste",KeyEvent.VK_E);
    	      JMenuItem delete= new JMenuItem("Delete",KeyEvent.VK_D);
    	      JMenuItem selectall=new JMenuItem("Select All",KeyEvent.VK_A);
    	      
    	      JMenuItem gotos=new JMenuItem("goto",KeyEvent.VK_G);
    		  JMenuItem stop=new JMenuItem("stop",KeyEvent.VK_T);
    		  JMenuItem refresh=new JMenuItem("refresh",KeyEvent.VK_R);
    		  JMenuItem source=new JMenuItem("source",KeyEvent.VK_O);
    		  
    		  JMenuItem about=new JMenuItem("About",KeyEvent.VK_B);
    		  JMenuItem ver=new JMenuItem("Version",KeyEvent.VK_V);	
    	      
    	      
    	      JMenuItem cutpopup=new JMenuItem("cut");
    	      JMenuItem copypopup=new JMenuItem("copy");
    	      JMenuItem pastepopup=new JMenuItem("paste");
    	      JMenuItem deletepopup=new JMenuItem("delete");
    	      JMenuItem sapopup=new JMenuItem("select all");
    		  
    	      Exitm.addActionListener(new ActionListener() {
    	    	  public void actionPerformed(ActionEvent e) {
    	    		  actionExit();
    	    	  }
    	      });
    	     
    		  New.addActionListener(new ActionListener(){
    			  public void actionPerformed(ActionEvent e){
    				  newfile();
    			  }
    		  });
    	      
    		  Save.addActionListener(new ActionListener()
    		  {
    			  public void actionPerformed(ActionEvent e)
    			  {
    				  save();
    			  }
    		  }); 
    		  
    		  Open.addActionListener(new ActionListener()
    		  {
    			public void actionPerformed(ActionEvent e)
    			{
    				open();
    			}
    		  });
    		  
    		  
    	      fileMenu.add(New);
    	      fileMenu.add(Open);
    	      fileMenu.add(Save);
    	      fileMenu.add(SaveAs);
    	      fileMenu.add(Print);
    	      fileMenu.add(Exitm);
    	      
    	     
    	      editMenu.add(cut);
    	      editMenu.add(copy);
    	      editMenu.add(paste);
    	      editMenu.add(delete);
    	      editMenu.add(selectall);
    	      
    	      viewMenu.add(gotos);
    	      viewMenu.add(stop);
    	      viewMenu.add(refresh);
    	      viewMenu.add(source);
    	      
    	      helpsMenu.add(about);
    	      helpsMenu.add(ver);
    	      
    	      
    	      menuBar.add(fileMenu);
    	      menuBar.add(editMenu);
    	      menuBar.add(viewMenu);
    	      //menuBar.add(historyMenu);
    	      menuBar.add(helpsMenu);
    	      setJMenuBar(menuBar);
    	     
    	      New.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,ActionEvent.CTRL_MASK));
    	      Open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,ActionEvent.CTRL_MASK));
    	      Save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,ActionEvent.CTRL_MASK));
    	      cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,ActionEvent.CTRL_MASK));
    	      copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEvent.CTRL_MASK));
    	      paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,ActionEvent.CTRL_MASK));
    	     // cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,ActionEvent.CTRL_MASK));
    	      //cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,ActionEvent.CTRL_MASK));
    	      
    	      
    	      popup.add(cutpopup);
    	      popup.add(copypopup);
    	      popup.add(pastepopup);
    	      popup.add(deletepopup);
    	      popup.add(sapopup);
    	      //add(popup);
    	      // Set up button panel.
    	      
    	      
    	      
    	      JPanel buttonPanel = new JPanel();
    	      backButton = new JButton("<<Back");
    	      
    	      backButton.addActionListener(new ActionListener() {
    	    	  public void actionPerformed(ActionEvent e) {
    	    		  actionBack();
    	    	  }
    	      });
    	      backButton.setEnabled(false);
    	      buttonPanel.add(backButton);
    	      
    	      forwardButton = new JButton("Forward>>");
    	      forwardButton.addActionListener(new ActionListener() {
    	    	  public void actionPerformed(ActionEvent e) {
    	    		  actionForward();
    	    	  }
    	      });
    	      forwardButton.setEnabled(false);
    		  buttonPanel.add(forwardButton);
    		
    		 
    	      ImageIcon ic4=new ImageIcon("d:\\r1.gif");
    	      JButton li4=new JButton(ic4);
    	      li4.addActionListener(new ActionListener()
    	      {
    	    	 public void actionPerformed(ActionEvent e)
    	    	 {
    	    		 //refresh();
    	    	 }
    	      }
    	      );
    	      buttonPanel.add(li4);
    	      
    	      ImageIcon ic3=new ImageIcon("d:\\p1.gif");
    	      JButton li3=new JButton(ic3);
    	      li3.addActionListener(new ActionListener()
    	      {
    	    	 public void actionPerformed(ActionEvent e)
    	    	 {
    	    		 //print();
    	    	 }
    	      }
    	      );
    	      buttonPanel.add(li3);
    	      
    	      ImageIcon ic2=new ImageIcon("d:\\h1.gif");
    	      JButton li2=new JButton(ic2);
    	      li2.addActionListener(new ActionListener()
    	      {
    	    	 public void actionPerformed(ActionEvent e)
    	    	 {
    	    		 //home();
    	    	 }
    	      }
    	      );
    	      buttonPanel.add(li2);
    	     
    	      ImageIcon ic=new ImageIcon("d:\\d1.gif");
    	      JButton li=new JButton(ic);
    	      li.addActionListener(new ActionListener()
    	      {
    	    	 public void actionPerformed(ActionEvent e)
    	    	 {
    	    		 //delete();
    	    	 }
    	      }
    	      );
    	      buttonPanel.add(li);
    		  
    		  locationTextField= new JTextField(35);
    		  locationTextField.addKeyListener(new KeyAdapter() {
    			public void keyReleased(KeyEvent e) {
    				if (e.getKeyCode() == KeyEvent.VK_ENTER) {
    					actionGo();
    				}
    			}
    		});
    		
    		buttonPanel.add(locationTextField);
    		JButton goButton = new JButton("GO");
    		goButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				actionGo();
    			}
    		});
    		buttonPanel.add(goButton);
    
    		// Set up page display.
    		displayEditorPane = new JEditorPane();
    		displayEditorPane.setContentType("text/html");
    		displayEditorPane.setEditable(false);
    		displayEditorPane.addHyperlinkListener(this);
            
    		displayEditorPane.addMouseListener(new MouseAdapter(){
    			   public void mousePressed(MouseEvent e)
    			   {
    				  if(e.isPopupTrigger())
    				  {
    					  popup.show(e.getComponent(),e.getX(),e.getY());
    				  }
    			   }
    			  public void mouseReleased(MouseEvent e)
    			  {
    				  if(e.isPopupTrigger())
    				  {
    					  popup.show(e.getComponent(),e.getX(),e.getY());
    				  } 
    			  }
    			  });
    		
    		
    		  
    		  
    		
    		getContentPane().setLayout(new BorderLayout());
    		getContentPane().add(buttonPanel, BorderLayout.NORTH);
    		getContentPane().add(new JScrollPane(displayEditorPane),
    				BorderLayout.CENTER);
         
    		cut.addActionListener(new ActionListener()
    		  {
    			public void actionPerformed(ActionEvent e)
    			{
    				displayEditorPane.cut();
    			}
    		  }
    		  );
    		  
    		  copy.addActionListener(new ActionListener()
    		  {
    				public void actionPerformed(ActionEvent e)
    				{
    					displayEditorPane.copy();
    				}
    			  }
    		   );
    		  
    		  paste.addActionListener(new ActionListener()
    		  {
    				public void actionPerformed(ActionEvent e)
    				{
    					displayEditorPane.paste();
    				}
    			  }
    			  );
    		  
    		  selectall.addActionListener(new ActionListener()
    		  {
    				public void actionPerformed(ActionEvent e)
    				{
    					displayEditorPane.selectAll();
    				}
    			  }
    			  );
    		
    		  cutpopup.addActionListener(new ActionListener()
    		  {
    				public void actionPerformed(ActionEvent e)
    				{
    					displayEditorPane.cut();
    				}
    			  }
    			  );
    		  
    		  copypopup.addActionListener(new ActionListener()
    		  {
    				public void actionPerformed(ActionEvent e)
    				{
    					displayEditorPane.cut();
    				}
    			  }
    			  );
    		  
    		  pastepopup.addActionListener(new ActionListener()
    		  {
    				public void actionPerformed(ActionEvent e)
    				{
    					displayEditorPane.cut();
    				}
    			  }
    			  );
          //JPanel p2=new JPanel();
          //JComboBox cm=new JComboBox();
          //cm.addItem("http://www.google.com");
          //cm.addItem("http://www.reidffmail.com");
          //cm.addItem("http://www.yahoomail.com");
          //buttonPanel.add(cm);
          
    		
    		
          ImageIcon ic1=new ImageIcon("d:\\s1.gif");
          JLabel li1=new JLabel(ic1);
          buttonPanel.add(li1);
          
          ImageIcon img=new ImageIcon("D:\\gmail.jpg");
          JButton bt=new JButton(img);
        
          bt.setPreferredSize(new Dimension(40, 40));
          bt.addActionListener(new ActionListener()
          {
        	  public void actionPerformed(ActionEvent e)
        	  {
        		  new MyWindowAdapter();
        	  }
          }
            
          );
          buttonPanel.add(bt);
         }	
    
          class MyWindowAdapter extends JFrame// implements ActionListener
          {
        	  JFrame fr;
        	  
        	  MyWindowAdapter()
        	  {
        	    fr=new JFrame();
        		fr.setVisible(true); 
        		fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        	    fr.setIconImage(Toolkit.getDefaultToolkit().getImage("d:\\logo.gif"));
        		fr.setSize(350,250);
        	    fr.setTitle("Login");
        	    fr.setLayout(null);
        	    
        	    us=new JLabel("Username:");
        	    us.setBounds(10,15,65,25);
        	    fr.add(us);
        	    
        	    tus=new JTextField();
        	    tus.setBounds(90,15,200,25);
        	    fr.add(tus);
        	    
        	    ps=new JLabel("Password:");
        	    ps.setBounds(10,55,65,25);
        	    fr.add(ps);
        	    
        	    tps=new TextField();
        	    tps.setBounds(90,55,200,25);
        	    tps.setEchoChar('*');
        	    fr.add(tps);
        	    
        	   
        	    
        	    btn=new JButton("Go");
        	    btn.setBounds(40,95,100,25);
        	    btn.addActionListener(new ActionListener()
        	    {
        	      public void actionPerformed(ActionEvent e)
        	      {
        	    	  user=tus.getText();
        		        pass=tps.getText();
        	    	  new LogUser(user,pass);
        	      }
        	    });
        	    fr.add(btn);
        	   	      
        	    em=new JLabel(" ");
        	    em.setBounds(10,140,65,25);
        	    fr.add(em);
        	  
        	    
        	   
        	      // String usname=tuser.getText();
        	      // String psname=tpass.getText();
        	    
        	  }
        	   
          }
         
         class UndoListener implements UndoableEditListener
         {
        	 public void undoableEditHappened(UndoableEditEvent e)
        	 {
        		 undo.addEdit(e.getEdit());
        		 undoAction.update();
        		 
        	 }
         }
         
         class UndoAction extends AbstractAction
         {
        	public UndoAction()
        	{
        		super("Undo");
        	}
        	public void actionPerformed(ActionEvent e)
        	{
        		try
        		{
        			undo.undo();
        		}
        		catch(CannotUndoException ex)
        		{
        			System.out.println("Unable to undo:"+ex);
        		    ex.printStackTrace();
        		}
        		update();
        	}
            protected void update()
            {
            	if(undo.canUndo())
            	{
            		setEnabled(true);
            		putValue("Undo",undo.getUndoPresentationName());
            	}
            	else
            	{
            		setEnabled(false);
            		putValue(Action.NAME,"Undo");
            	}
            }
         }
          
         class  LogUser 
         {
        	 LogUser(String user,String pass)
        	 {
        		 try {
    				   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    				   Connection con = DriverManager.getConnection("jdbc:odbc:login"); 
    				   String query="select * from login";
    				   PreparedStatement st=con.prepareStatement(query);
    				   ResultSet rs = st.executeQuery();
    				   while(rs.next())
    				   {
    				        String use=rs.getString("email");
    				        String pas=rs.getString("pass");
    					    if(user.equals(use)&& pass.equals(pas))
    				        {
    					        displaygmail();
    				        }
    					    else 
    					    {
    					    	System.out.println("Sorry  dude");
    					     }   
    					    }
    				    con.close();
    			      } catch (ClassNotFoundException ce) {
    			    	// TODO Auto-generated catch block
    				  ce.printStackTrace();
    			      } catch (SQLException se) {
    				  // TODO Auto-generated catch block
    				  se.printStackTrace();
    			     }
        	 }
         }
    	// Exit this program.
    	private void actionExit() {
    			System.exit(0);
    		}
    
    	
    	
    	
    	private void newfile()
    	{
    		
    		if(!locationTextField.equals(" "))
    		{
    		   opened=false;
    		   int confirm=JOptionPane.showConfirmDialog(null,"Text has been changed in your file\n Do you want to save the changes","New File",
    			JOptionPane.OK_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
    		
    		    if(confirm==JOptionPane.OK_OPTION)
    		    {
    		     save();
    		     locationTextField.setText(null);
    		    }
    		    if(confirm==JOptionPane.CANCEL_OPTION)
    		    {
    		     locationTextField.setText(null);	
    		    }
    		}
    	}
    	 
    	private void save()
    	{
    		JFileChooser fc = new JFileChooser();
    		FileFilter filter1 = new ExtensionFileFilter("JPG and JPEG", new String[] { ".JPG", ".JPEG" });
    	    int returnVal = fc.showDialog(Entry.this, "Save File");    	
    	    
    		if(returnVal==JFileChooser.APPROVE_OPTION)
    		{
    			filename=String.valueOf(fc.getSelectedFile());
    	        setTitle(filename);
    	        
    	        try {
    				
    	        	FileWriter f=new FileWriter(filename);
    	        	f.write(locationTextField.getText());
    			    f.close();
    	        	
    	        	
    	        	
    			    opened=true;
    	        } 
    	          catch(FileNotFoundException fe)
    	          {
    	        	JOptionPane.showMessageDialog(this,"Requested File not Found","Error Dialog Box",JOptionPane.ERROR_MESSAGE);
    	          }
    	        
    	        catch (IOException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    		}
    	
    	 private void open()
    	 {
    		 JFileChooser fch=new JFileChooser();
    		 fch.setCurrentDirectory(new File("."));
    		 fch.setFileFilter(new javax.swing.filechooser.FileFilter()
    		 {
    			  public boolean accept(File f)
    			  {
    			    return f.isDirectory()|| f.getName().toLowerCase().endsWith(".java");
    			  }
    			 
    			  public String getDescription()
    			  {
    				 return "Java Files";
    			  }
    		  });
    		 int rv = fch.showDialog(Entry.this, "Open File");
    	 }
    	
    	class ExtensionFileFilter extends FileFilter {
    		  String description;
    
    		  String extensions[];
    
    		  public ExtensionFileFilter(String description, String extension) {
    		    this(description, new String[] { extension });
    		  }
    
    		  public ExtensionFileFilter(String description, String extensions[]) {
    		    if (description == null) {
    		      this.description = extensions[0];
    		    } else {
    		      this.description = description;
    		    }
    		    this.extensions = (String[]) extensions.clone();//duplicating the received extensions
    		    toLower(this.extensions);//make the extensions in lower case
    		  }
    
    		  private void toLower(String array[]) {
    		    for (int i = 0 ,n = array.length; i < n; i++) {
    		      array[i] = array[i].toLowerCase();
    		    }
    		  }
    
    		  public String getDescription() {
    		    return description;
    		  }
    
    		  public boolean accept(File file) {
    		    if (file.isDirectory()) {
    		      return true;
    		       }
    		      else
    		      {
    		         String path = file.getAbsolutePath().toLowerCase();
    		         for (int i = 0, n = extensions.length; i < n; i++) {
    		          String extension = extensions[i];
    		          if ((path.endsWith(extension) && (path.charAt(path.length() - extension.length() - 1)) == '.')) {
    		          return true;
    		        }
    		      }
    		    }
    		    return false;
    		  }
    		}
    
     
    	// Go back to the page viewed before the current page.
    	private void actionBack() {
    		URL currentUrl = displayEditorPane.getPage();
    		int pageIndex = pageList.indexOf(currentUrl.toString());
    		try {
    			 showPage(new URL((String) pageList.get(pageIndex - 1)), false);
    		    }
    		 catch (Exception e) {}
    		 }
    
    	// Go forward to the page viewed after the current page.
    	private void actionForward(){
    		URL currentUrl = displayEditorPane.getPage();
    		int pageIndex = pageList.indexOf(currentUrl.toString());
    		try {
    			 showPage(new URL((String) pageList.get(pageIndex + 1)), false);
    			}
    		catch (Exception e) {}
    		}
          
    	// Load and show the page specified in the location text field.
    	    private void actionGo() {
    		URL verifiedUrl = verifyUrl(locationTextField.getText());
    		if (verifiedUrl != null) {
    			showPage(verifiedUrl, true);
    		} else {
    			showError("Invalid URL");
    		}
    		}
    
    	// Show dialog box with error message.
    	private void showError(String errorMessage) {
    	JOptionPane.showMessageDialog(this, errorMessage,"Error", JOptionPane.ERROR_MESSAGE);
    	}
    
    	// Verify URL format.
    	private URL verifyUrl(String url) {
    	// Only allow HTTP URLs.
    	if (!url.toLowerCase().startsWith("http://"))
    	return null;
    
    	// Verify format of URL.
    	URL verifiedUrl = null;
    	 try 
    	 {
    	   verifiedUrl = new URL(url);
    	  }
    	  catch (Exception e) {
    	 return null;
    	 }
         return verifiedUrl;
    	}
    	
    	private void displaygmail()
    	    {
    		 try 
    		  {
    			 showPage(new URL("https://mail.google.com/mail/h"),false);
    		    }
    		  catch (Exception e) 
    		   {
    			 e.printStackTrace();
    		   }
    		 }
    	
    	
    	/* Show the specified page and add it to
    	the page list if specified. */
    	private void showPage(URL pageUrl, boolean addToList)
    		{
    		// Show hour glass cursor while crawling is under way.
    		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            try 
    		{
    			// Get URL of page currently being displayed.
    			URL currentUrl = displayEditorPane.getPage();
    
    			// Load and display specified page.
    			displayEditorPane.setPage(pageUrl);
    	
    			URL newUrl = displayEditorPane.getPage();
    
    			if (addToList) {
    				int listSize = pageList.size();
    				if (listSize > 0) {
    					int pageIndex =	pageList.indexOf(currentUrl.toString());
    					if (pageIndex < listSize - 1) {
    						for (int i = listSize - 1; i > pageIndex; i--) {
    							pageList.remove(i);
    						}
    					}
    				}
    				pageList.add(newUrl.toString());
    			}
    
    			locationTextField.setText(newUrl.toString());
    
    			updateButtons();
    		}
    		catch (Exception e)
    		{
    			//showError("Unable to load page");
    		}
    		finally
    		{
    			// Return to default cursor.
    			setCursor(Cursor.getDefaultCursor());
    		}
    		}
    		private void updateButtons() {
    			if (pageList.size() < 2)
    			{
    				 backButton.setEnabled(false);
    				 forwardButton.setEnabled(false);
    			} 
    			else
    			{
    				URL currentUrl = displayEditorPane.getPage();
    				int pageIndex = pageList.indexOf(currentUrl.toString());
    				backButton.setEnabled(pageIndex > 0);
    				forwardButton.setEnabled(
    						pageIndex < (pageList.size() - 1));
    			}
    		}
    
    public void hyperlinkUpdate(HyperlinkEvent event) 
     {
    	  HyperlinkEvent.EventType eventType = event.getEventType();
    	if (eventType == HyperlinkEvent.EventType.ACTIVATED)
    	 {
        	if (event instanceof HTMLFrameHyperlinkEvent) 
        	  {
            	HTMLFrameHyperlinkEvent linkEvent =(HTMLFrameHyperlinkEvent) event;
            	HTMLDocument document =(HTMLDocument) displayEditorPane.getDocument();
            	document.processHTMLFrameHyperlinkEvent(linkEvent);
        	  } 
        	else 
    		{
    			showPage(event.getURL(), true);
    		}
    	 }
    	}
    
    
    	public static void main(String[] args) {
    		Entry en=new Entry();
    		en.setTitle("Wyzo");
    		en.setVisible(true);
    		en.setSize(9500,1000);
    		en.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		}
    
    }
    Last edited by Norm; 01-14-2012 at 12:43 PM. Reason: added code tags

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: how to provide language support?

    if I am going click on the button on that page the button is not responding.
    What is the "button" you click on? Does the button have a listener?

    How can your code be tested to see the problem?

Similar Threads

  1. how provide the method ?
    By pruton in forum New To Java
    Replies: 4
    Last Post: 06-13-2010, 04:41 PM
  2. Please provide some help
    By saurabh_87 in forum New To Java
    Replies: 3
    Last Post: 04-23-2009, 08:38 AM
  3. can anybody please provide me the java tutorials
    By vislawath.jawaharlal in forum Threads and Synchronization
    Replies: 1
    Last Post: 04-07-2009, 03:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •