Why won't java based web browser load a web page?
-
Found a java based web browser source code online, but for some reason or another, the program won't open the page and keeps returning the error. i am not sure if there is a corrupted file in the java JDE that I have, or if it's something else. here s the code I think is the problem: // Load and show the page specified in the location text field. private void actionGo() { boolean b; if( !locationTextField.getText().startsWith(... { String a = locationTextField.getText(); locationTextField.setText("http://"+a); } 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; } /* 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(Cur... try { // Get URL of page currently being displayed. URL currentUrl = displayEditorPane.getPage(); // Load and display specified page. displayEditorPane.setPage(pageUrl); // Get URL of new page being displayed. URL newUrl = displayEditorPane.getPage(); // Add page to list if specified. 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()); } // Update location text field with URL of current page. locationTextField.setText(newUrl.toStrin... // Update buttons based on the page being displayed. updateButtons(); } catch (Exception e) { // Show error messsage. showError("Unable to load page"); } finally { // Return to default cursor. setCursor(Cursor.getDefaultCursor()); } }
-
Answer:
Maybe because you put down the incorrect variables. Enter the new variables and correct 'em before moving on!
Death Egg Zone at Yahoo! Answers Visit the source
Other answers
Maybe because you put down the incorrect variables. Enter the new variables and correct 'em before moving on!
Related Q & A:
- Why won't the applets load on our Yahoo online games?Best solution by Yahoo! Answers
- Why won't my audibles load anymore?Best solution by Yahoo! Answers
- Why won't the chatroom lists load?Best solution by support.google.com
- Why won't word racer load?Best solution by Yahoo! Answers
- Why won't My Yahoo home page load?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.