Java Web Browser Problem

Java Web Browser Problem

Hello When run my web browser this is not displaying complete page any of the website like other browser.So Plz help me.

package vision.sun;


import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.URL;
import java.util.Stack;
import java.util.jar.JarFile;


import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;


public class WebBrowser2 {

    @SuppressWarnings("deprecation")
    public static void main(String args[])
    {
        JFrame frame=new EditorPaneFrame();
        frame.show();
    }
}
class EditorPaneFrame extends JFrame
{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private JTextField url;
    private JCheckBox editable;
    private JButton loadButton;
    private JButton backButton;
    private JEditorPane editorPane;
    private JMenuItem FavAdd;
    JarFile jar;
    private Stack<String> urlStack=new Stack<String>();


    public EditorPaneFrame()
    {
        if(isConnected())
            System.out.println("Proxy Connected.");
        setTitle("NextVision Browser");
        setSize(600,400);
        Container contentPane = getContentPane();

        addWindowListener(new WindowAdapter()  {

            public void windowClosing(WindowEvent e)
            {
                System.exit(0);
            }
        });

        url=new JTextField(30);
        loadButton=new JButton("Load");
        loadButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try
                {

                    URL netURL=new URL(url.getText());
                    urlStack.push(url.getText());

                    editorPane.setPage(netURL);

                }
                catch(Exception ex)
                {
                    ex.printStackTrace();
                }
            }
        });
        // set up back button and button action
         backButton = new JButton("<<");
         backButton.addActionListener(new ActionListener()
         {
        public void actionPerformed(ActionEvent event)
         {
        if(urlStack.size()<=1) return;
        try
         {
         urlStack.pop();
         String urlString = (String)urlStack.peek();
         url.setText(urlString);
         editorPane.setPage(urlString);
         }
        catch(IOException e)
         {
         editorPane.setText("Error : " +e);
         }
         }
         });

         editorPane = new JEditorPane();
         editorPane.setEditable(false);
         editorPane.addHyperlinkListener(new HyperlinkListener()
         {
        public void hyperlinkUpdate(HyperlinkEvent event)
         {
        if(event.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
         {
        try
         {
         urlStack.push(event.getURL().toString());
         url.setText(event.getURL().toString());
         editorPane.setPage(event.getURL().toString());
         }
        catch(IOException e)
         {
         editorPane.setText("Error: " + e);
         }

         }
         }
         });
         editable = new JCheckBox();
         editable.addActionListener(new ActionListener()
         {
        public void actionPerformed(ActionEvent event)
         {
         editorPane.setEditable(editable.isSelected());
         }
         });

         //referesh=new JButton("Referesh");

         contentPane.add(new JScrollPane(editorPane), "Center");
         JPanel panel = new JPanel();
         panel.add(new JLabel("URL"));
         panel.add(url);
         panel.add(loadButton);
         panel.add(backButton);
         panel.add(new JLabel("Editable"));
         panel.add(editable);
         //panel.setBounds(10, 10, 50, 60);
         JMenuBar objMenuBar=new JMenuBar();
         JMenu objMenu=new JMenu("File");
         JMenu objSetting=new JMenu("Setting");
         JMenu objFavourite=new JMenu("Favourite");
         objMenuBar.add(objMenu);
         objMenuBar.add(objFavourite);
         JMenuItem objMenuItem=new JMenuItem("New");
         JMenuItem objMenuExit=new JMenuItem("Exit");
         JMenuItem OpenRun=new JMenuItem("Open Type");
         objMenu.add(objMenuItem);
         objMenu.add(OpenRun);
         objMenu.add(objMenuExit);
         JMenuItem Internet=new JMenuItem("Connection");
         FavAdd=new JMenuItem("Add Address");
         objMenuBar.add(objSetting);
         objFavourite.add(FavAdd);
         objSetting.add(Internet);

         contentPane.add(panel,"South");
         contentPane.add(objMenuBar,"North");
         FavAdd.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                JOptionPane.showMessageDialog(null, "Program Under Progress !");

            }
        }
                 );
         objMenuExit.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                if(JOptionPane.showConfirmDialog(null, "Are You Sure To Exit ?","Message",JOptionPane.CANCEL_OPTION)==0)
                {
                System.exit(0);
                }
            }
        });

         OpenRun.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                runCommand();
            }
        });
    }
    private void runCommand()
    {
        String inputCommand=null;
        try
        {
        inputCommand=JOptionPane.showInputDialog(null,"Enter Command Here");
        if(inputCommand!=null)
        {
            Runtime runtime=Runtime.getRuntime();
            runtime.exec(inputCommand);
        }
        }
        catch(Exception ex)
        {
            System.out.println(ex.getMessage());
            if(ex.getMessage().toString().indexOf("The system cannot find the file specified")!=-1)
            {
                JOptionPane.showMessageDialog(null, "Invalid Command !");
                runCommand();
            }
            else if(ex.getMessage().toString().indexOf("Empty command")!=-1)
            {
                JOptionPane.showMessageDialog(null, "Please Enter Command !");
                runCommand();
            }
            else if(ex.getMessage().toString().indexOf("Access is denied")!=-1)
            {
                JOptionPane.showMessageDialog(null, "Invalid Command !");
                runCommand();
            }
            else if(ex.getMessage().toString().indexOf("The parameter is incorrect")!=-1)
            {
                JOptionPane.showMessageDialog(null, "Invalid Command !");
                runCommand();
            }
        }
    }
    private boolean isConnected()
    {

        //System.setProperty("http.proxyHost","10.0.0.3");
        //System.setProperty("http.proxyPort","6588");
        String host=System.getProperty("http.proxyHost");
        String port=System.getProperty("http.proxyPort");
                System.out.println("host is "+host);
                System.out.println("port is "+port);
        System.setProperty("https.proxyHost", "10.0.0.3");
        System.setProperty("https.proxyPort", "6588");
        if(!host.equals("")&&!port.equals(""))
        return true;
        else
        return false;
    }
}
View Answers









Related Tutorials/Questions & Answers:
Java Web Browser Problem
Java Web Browser Problem  Hello When run my web browser this is not displaying complete page any of the website like other browser.So Plz help me...."); setTitle("NextVision Browser"); setSize(600,400); Container
Applet run with appletviewer but not in browser, any code problem.
Applet run with appletviewer but not in browser, any code problem.  ... the 52 cards will be show in browser as by "appletviewer" and run as "java applet" I... as java applet its working, but not on browser. Please check can I call
Advertisements
Java web start problem with jre 1.6 - Java Beginners
Java web start problem with jre 1.6  Hi all, We are using jnlp... in the client side using Java web start. Using three jnlp files we are doing... it with Java Web Start --%>
web service problem - WebSevices
web service problem  I have created web service client and server for File transfering using axis2/java.I want to add JAX-RPC client Handler...; Thank u....Actually web service without client handler is working. I want
ModuleNotFoundError: No module named 'eilat-web-browser'
ModuleNotFoundError: No module named 'eilat-web-browser'  Hi, My... named 'eilat-web-browser' How to remove the ModuleNotFoundError: No module named 'eilat-web-browser' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'eilat-web-browser'
ModuleNotFoundError: No module named 'eilat-web-browser'  Hi, My... named 'eilat-web-browser' How to remove the ModuleNotFoundError: No module named 'eilat-web-browser' error? Thanks   Hi, In your
Show pdf's in web browser by using jsp?
Show pdf's in web browser by using jsp?  Hi, I want to display pdf file in browser by clicking the link, available in JSP page. When am trying to do this by using Anchor tag with absolute path, it is showing the error as: Http
to run html code in web browser - JSP-Servlet
to run html code in web browser  how to run jsp file which calls html file on web browser??  Hi Friend, Try the following code: 1)form.jsp: Enter Name: 2)welcome.html: Add Profile Edit
how to present the excel to the web browser in jsp
how to present the excel to the web browser in jsp  How to present the content of the newly created excel file in the following jsp to the web browser: <%@ page import="java.io.InputStream" %> <%@ page import
browser
in the swing because I am working on my project Browser and one more problem is that when I entered the URL then some page open which made in java and the page
how to display the excel file in the web browser.
how to display the excel file in the web browser.  > %@ page import="java.io.InputStream" > %> <%@ page > import="org.apache.poi.xssf.usermodel.XSSFSheet"%> > <%@ page > import
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database
Null pointer exceptation-Java Servlet web application,Problem connecting.... T_T I have develop my java web application in window Environment and now i.... T_T I have develop my java web application in window Environment and now i
browser
browser  how to make a browser
Browser making by java coding
Browser making by java coding  import javax.swing.*; import...*; import java.io.*; public class Browser extends JFrame implements...[]) { if(args.length==0) new Browser ("http:google.com"#; else new Browser#args#0
opening new browser with new JSESSIONID using java
opening new browser with new JSESSIONID using java  I am facing following problem, I am trying to open a new browser using java. First i have opened one IE browser and manually. And i ran my LaunchURL.java file, it is opening new
Opening a browser only with body from a java program
Opening a browser only with body from a java program  Hi all, I got following requirement, Opening a browser window only with body and title bar... to launch web browser"; public static void openURL(String url) { try
Problem In applet Its run on browser but hang and blinking when image is draging some where.
Problem In applet Its run on browser but hang and blinking when image is draging some where.  I am Created applet in working properly on browser... browser and come back only gray screen shows, I thing you are understanding
Toolbar to a browser - Java Beginners
to display toolbar on the browser? Thanks  I want to create a website's... browser, some site ask us to download the application and install it. so i wanted
java Problem
java Problem  I want to create a binary tree for displaying members in Downline. i am creating a site for MLM(Multi-Level MArketing). tree must be dynamically populated from database. is there any help for me. Thanks in advance
JAVA Problem
JAVA Problem  Write a program that takes two parameters 1. a word 2. an array of words It should then remove all instances of the word in the array. For Example: INPUT word="ravi" word_array = ["Chethan Bhagat
JAVA CLASSPATH PROBLEM
JAVA CLASSPATH PROBLEM  hi all Friends I am stuck using the java servlets and problem raise for classpath. I had a problem with servlet to call... that it didn't found any java class (which is java class calling from servlet). but i
how to get browser cookies in java
how to get browser cookies in java  Hi, How to get cookies in serverlet and then print? how to get browser cookies in java? Thanks   Hi, Use following code: Cookie[] cookies = request.getCookies(); for (int i = 0
browser
browser  how to add menu items in the menu in java swing through java coding
resolution problem in java
resolution problem in java  I designed project in java in my PC when run the same project in some other PC i can't fully view my java forms.Some said that it is resolution problem
Java problem - Java Beginners
Java problem  I have an image in my application and I need to restrict the image path view on the browser. Noone should be able to right click and see the image path. Please help
Browser tire - Java Interview Questions
Browser tire  If we use multithreading in my application then which tire is needed on clients browser so that application run successfully? Plz help me ass soon as possible
java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to [email protected]
Problem in uploading java application
Problem in uploading java application  I have uploaded my java application (folder created under webapps) using Filezilla FtpClient.Application... this problem
for a problem in coading - Java Beginners
for a problem in coading  what is the problm in following coading...(String[] args) { mywindow (); } }   Hi Friend, There is no problem... mywindows.java Run : java mywindows Thanks RoseIndia Team
Multiplication problem - Java Beginners
Multiplication problem  I am facing a peculiar problem in java regarding a multiplication. Please see below: 19300 * 0.001 = 19.3 19400 * 0.001 = 19.400000000000002 (why is this ??) 19500 * 0.001 = 19.5 Can anybody help
Java Problem - JSP-Servlet
by clicking the startup.bat. Open your web browser and put the following url...Java Problem  How to run a Simple JSP program ? what steps... the classpath in Environment variables. 4)Create a web application folder inside
java input problem - Java Beginners
java input problem  I am facing a Java input problem
code problem - Java Beginners
java script j2ee j2me sql plz help me to sort out this problem. thnx  ...code problem  Dear sir, I'm havin a problem that suppose i've got a file that contains the following lines- java java script j2ee php sql
Problem on JAVA Programme
Problem on JAVA Programme  public class AA { int add(int i) { int y = i; y += 20; if (y <= 100){ y +=30;add(y);} System.out.println("Final Value of y : " + y); return y; } public static void main
Embed Default Browser within Java Application
Embed Default Browser within Java Application  After some googling i... to embed browser with or without using NetbeansADS_TO_REPLACE_1 I ve already tried this 2 minutes Browser But i m getting the error in netbeans
java programming problem - JDBC
java programming problem  Hi, Request you to provide a solution... problem to the following mail id : Problem : upload excel file data into oracle database using java / j2ee. mail id : [email protected]
opening internet browser in java program - Swing AWT
opening internet browser in java program  i want a code to open the internet browser in swing program using JFrame.  Hi Omkar, Use..." }; String browser = null; for (int count = 0; count <
Java Swing Open Browser
Java Swing Open Browser Java provides different methods to develop useful... that will open the specified url on the browser using java swing. This example will really... opens the default browser with the specified url. Here is the code: 1
Java Problem - Java Beginners
Java Problem  Write a program 2 input a positive integer n and check wheter n is prime or not and also know the position of that number in the prime..., Code to solve the problem : import java.io.*; public class PrimeNumber
Cross platform browser question - Java Beginners
-browser (works in Firefox and MS IE) web page using anonymous JS methods...Cross platform browser question  Can you tell me what this is specifially asking for? I have my program that works fine, but the instructor said
Java implementation problem
/answers/viewqa/Java-Beginners/28578-java-implementation-problem-.html...Java implementation problem  I want to implement following in java... problem in your post previews. please consider 1. 2. points just after main
code problem - Java Beginners
; Hi friend, Code to help in solving the problem : import java.io.... in Java visit to : http://www.roseindia.net/java/example/java/io/ Thanks
java implementation problem
java implementation problem   I want to implement following in java code : Main thread Create three threads wait for completion of stage 2 of all three threads Access all three local variable (LC0, LC1, LC2) of threads bulid
problem 1 - Java Beginners
problem 1   Hi, please help me!!!! How can i code in java using Two-dimensional Arrays? This question is related to the one i posted before. this is my input data file: 88 90 94 102 111 122 134 75 77 80 86 94 103 113 80
code problem - Java Beginners
code problem  Dear sir, I have an excel file in D: drive called today.xls, i want to open it thru java program, what code would be compatible plz help me  Hi friend, Code to help in solving the problem : import
Basic problem for Java experts
Basic problem for Java experts  This assignment will test your knowledge of Arrays Array searching Array sorting Array processing Specification An athletics club require a simple statistical analysis program for analysing lap
problem with main - Java Beginners
problem with main   import javax.swing.*; import java.awt.... a problem. when i compile it appears this message: java.lang.NoSuchMethodError: main... it with html file. applet.html: Java Applet Demo Thanks
code problem - Java Beginners
code problem  Dear sir, my problem is that I've a string value if this String value has "quit" then output should be "bye". i want to make this program using SWITCH CASE statement. how to implement String value in Switch plz
Bid Problem - Java Beginners
in this application explain in details : Code to help in solving the problem...!"); } } } For more information on Java visit to : http://www.roseindia.net/java/ Thanks
Problem with code - Java Beginners
Problem with code  Hi Deepak. Im a newbie here at your forum. I have got a simple code of mine which is having a little problem. When I compile it, i get an...,identifier expected'...error. Could you help me out? Thank you

Ads