How do i build an internet browser?

i want to build an internet browser, with the following options...
- the only graphics it displays are those on the google (or other specified search engine) page
- all other pages, it returns only text, and the html used to build that page
can anyone point me in the right direction? i cant find anything specific in the help docs, so a rtfm wont help me here =P

Look at this URL : http://archive.corewebprogramming.com/ . What you wantis under chapter 14. Here is the Browser.java courtesy of Core Web Programming by Hall & Brown. I own this book, may be you might be interested in dog eared 2nd copy for a reasonable price!
Hopefully, this'll make short work of your exercise.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
/** Very simplistic "Web browser" using Swing. Supply a URL on
* the command line to see it initially and to set the
* destination of the "home" button.
* Taken from Core Web Programming from
* Prentice Hall and Sun Microsystems Press,
* http://www.corewebprogramming.com/.
* © 2001 Marty Hall and Larry Brown;
* may be freely used or adapted.
public class Browser extends JFrame implements HyperlinkListener,
ActionListener {
public static void main(String[] args) {
if (args.length == 0)
new Browser("http://www.corewebprogramming.com/");
else
new Browser(args[0]);
private JIconButton homeButton;
private JTextField urlField;
private JEditorPane htmlPane;
private String initialURL;
public Browser(String initialURL) {
super("Simple Swing Browser");
this.initialURL = initialURL;
addWindowListener(new ExitListener());
WindowUtilities.setNativeLookAndFeel();
JPanel topPanel = new JPanel();
topPanel.setBackground(Color.lightGray);
homeButton = new JIconButton("home.gif");
homeButton.addActionListener(this);
JLabel urlLabel = new JLabel("URL:");
urlField = new JTextField(30);
urlField.setText(initialURL);
urlField.addActionListener(this);
topPanel.add(homeButton);
topPanel.add(urlLabel);
topPanel.add(urlField);
getContentPane().add(topPanel, BorderLayout.NORTH);
try {
htmlPane = new JEditorPane(initialURL);
htmlPane.setEditable(false);
htmlPane.addHyperlinkListener(this);
JScrollPane scrollPane = new JScrollPane(htmlPane);
getContentPane().add(scrollPane, BorderLayout.CENTER);
} catch(IOException ioe) {
warnUser("Can't build HTML pane for " + initialURL
+ ": " + ioe);
Dimension screenSize = getToolkit().getScreenSize();
int width = screenSize.width * 8 / 10;
int height = screenSize.height * 8 / 10;
setBounds(width/8, height/8, width, height);
setVisible(true);
public void actionPerformed(ActionEvent event) {
String url;
if (event.getSource() == urlField) {
url = urlField.getText();
} else { // Clicked "home" button instead of entering URL.
url = initialURL;
try {
htmlPane.setPage(new URL(url));
urlField.setText(url);
} catch(IOException ioe) {
warnUser("Can't follow link to " + url + ": " + ioe);
public void hyperlinkUpdate(HyperlinkEvent event) {
if (event.getEventType() ==
HyperlinkEvent.EventType.ACTIVATED) {
try {
htmlPane.setPage(event.getURL());
urlField.setText(event.getURL().toExternalForm());
} catch(IOException ioe) {
warnUser("Can't follow link to "
+ event.getURL().toExternalForm() + ": " + ioe);
private void warnUser(String message) {
JOptionPane.showMessageDialog(this, message, "Error",
JOptionPane.ERROR_MESSAGE);
}

Similar Messages

  • HT5730 After I installed 10.8.48.4 Internet browsing slowed down to the pace of a dial-up connection.  How can I get back to normal operating speed?

    After I installed 10.8.4, my Internet browsing slowed down to the pace of a dial-up connection -- unless it froze up completely.  How do I get my system back to a normal operating mode?  Can I dump 10.8.4 and go back to the one that at least worked?

    Please answer as many of the following questions as you can. You may already have answered some of them.
    1. Have you restarted your router and broadband modem since you first noticed the problem? If the answer is no, do that now and see whether there's any change.
    2. Are any other web browsers installed, and are they also slow?
    3. What about other Internet applications, such as iTunes and the App Store?
    4. Are there any other devices on the same network that can browse the Web, and are they also slow?
    5. If you can test Safari on another network, is it slow there too?
    6. If you connect to your router with Wi-Fi and you can also connect with Ethernet, do that and turn off Wi-Fi. Any difference?

  • BlackBerry Z10 Internet Browser pops up 8 preview windows - how do you pick what is in the 8 preview windows ?

    In main Home Display, I click Browser and it pops up 8 preview window panes for me, which is most helpful.  I have some there I use frequently such as a traffic site.  But, my 8 preview window panes have no button I can click which allows me to add a window to that, nor any way I can see to remove 6 of the 8 I have no interest in ever seeing again, ever.
    How do I delete 1 of the 8 preview window panes in Internet Browser, and replace the 8 with what I want to show-up there please ?
    Thank you.
    Give Thumbs-Up if helps you, or say Solution Accepted, or say Like.

    I deleted the Bookmarks for the 6 of the 8 I never want to see again.  They still fill-up 6 of the 8 slots.  I have no interest in those 6 and cannot figure out how to get rid of 6 of the 8.  I have 6 others I definitely do want to have with the 2 of the 8 I already have in there, like the Traffic.
    Give Thumbs-Up if helps you, or say Solution Accepted, or say Like.

  • How can I add Internet browser back/forward buttons to the main toolbar?

    The developper of the software I'm testing manages to open
    web-pages in a window within our software. We find this a great
    feature, although it has one downside: no back/forward buttons the
    users have gotten used to thru standard Internet browsers.
    Is there any way to add these classic Internet browsing
    buttons to the main toolbar of a WebHelp output? I've noticed them
    on some other outputs (HTML-help if I'm not mistaken).
    I've noticed some similar topics in this forum, but the seem
    to discuss the browsing sequence buttons, which we find less
    usefull.
    Thanks for looking into this!
    Greetings,
    Olivier

    Hi Olivier
    Take a look at my Skinny on Skins file. There are
    instructions inside on how to accomplish this.
    Cheers... Rick

  • The font on my internet browser and mail has changed.  How do I change it back to a standard font?

    The font on my internet browser and mail has changed.  How do I change it back to a standard font? 

    Assuming you're using Safari, with Safari running open Safari's Preferences (Preferences in the Safari menu). Go to the Appearance tab, and set the ones you want.
    Assuming you're using Mail, open Mail's Preferences (Preferences in the Mail menu). Go to the Fonts & Colors tab, and set the ones you want.

  • Openning a Link from MS Office OneNote 2007 launches MS Internet Explorer althoug FireFox is my default Internet browser. Any idea how to cause OneNote 2007 to Launch FireFox instead?

    Openning a Link from MS Office OneNote 2007 launches MS Internet Explorer althoug FireFox is my default Internet browser. Any idea how to cause OneNote 2007 to Launch FireFox instead?

    Below is how it is being done.  This worked perfectly for years. MS Office 2007 does complain that the file extension does not match the data format (it's a tab delimited text file but I'm pretending it's an Excel file so they'll be prompted to view it as a spreadsheet in Excel) but you just click open and it works fine.  This issue with IE is new.  Let me know if you have any more ideas.
    <CFSETTING ENABLECFOUTPUTONLY="Yes" SHOWDEBUGOUTPUT="No">
    <!--- variables used for separating cells with tabs, and for new rows --->
    <CFSET tabchar=chr(9)>
    <CFSET newline=chr(13) & chr(10)>
    <!--- tell browser it's an Excel file --->
    <CFCONTENT TYPE="application/vnd.ms-excel">
    <!--- tell Internet Explorer to open as Excel file --->
    <CFHEADER NAME="Content-Disposition" VALUE="filename=myfile.xls">
    <!--- get data --->
    <CFQUERY NAME="getinfo" DATASOURCE="mydsn">
        select fieldone, fieldtwo
        from mytable
    </CFQUERY>
    <!--- output column headings --->
    <CFOUTPUT><CFLOOP INDEX="q" LIST="fieldone,fieldtwo">#q##tabchar#</CFLOOP>#newline#</CFOUTPUT>
    <!--- output database records --->
    <CFOUTPUT QUERY="getinfo">#getinfo.fieldone##tabchar##getinfo.fieldtwo##newline#</CFOUTPUT>

  • I cleared the internet browsing history a few days ago. Since then, no history from these few days has been saved in there. How can i get it to save again?

    I cleared the internet browsing history a few days ago. Since then, no history from these few days has been saved in there. How can i get it to save again?

    I have solved the problem. I accidentally have set it to private browsing.

  • How to set the same in mozilla? : 1. Go to Tools(Internet Browser)- Internet Options- Security

    ''locking this thread as duplicate, please continue at [https://support.mozilla.org/questions/1002512]''
    We are using a tool called BMC and we are unable to run reports. In IE the settings 1. Go to Tools(Internet Browser)->Internet Options->Security
    2. Select the Security tab
    3. Click on the Internet zone icon at the top of the tab page
    4. Click the Custom Level button
    5. In the Miscellaneous section change Display mixed content to Enable
    6. Repeat steps 1 – 5 for the Local intranet and Trusted sites zones
    solved the issue, could u suggest how to set the same in Firefox pls?
    Thank you!

    ''locking this thread as duplicate, please continue at [https://support.mozilla.org/questions/1002512]''
    We are using a tool called BMC and we are unable to run reports. In IE the settings 1. Go to Tools(Internet Browser)->Internet Options->Security
    2. Select the Security tab
    3. Click on the Internet zone icon at the top of the tab page
    4. Click the Custom Level button
    5. In the Miscellaneous section change Display mixed content to Enable
    6. Repeat steps 1 – 5 for the Local intranet and Trusted sites zones
    solved the issue, could u suggest how to set the same in Firefox pls?
    Thank you!

  • How to internet browsing from the wifi.....not from my service provider.

    i want to know how to internet browsing from the wifi connection not from the "DATA SERVICE" when i off my data service from mobile network option then i can't able to surf.........my wifi connection is on and connected.
    Thanks guys.... 

    Do not turn off the Data Services. Just turn off your mobile network connection in the Manage Connections screen.
    Go to Options > Advanced > Browser and set your browser to Hotspot, and save. Now, use the browser with the Wifi connection for surfing the internet.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to load another internet browser (Curve 8330m)

    How do I go about loading another internet browser?  I downloaded the Opera Mini and tried to make it as the default browser but couldn't seem to get it to work properly.
    Can anyone point me to some documentation (nothing seems to be in the Blackberry Technical Solutions Center) or give me some step-by-step instructions on how to do this?

    LoboFan wrote:
    I do realize that.
    How can I get the browser to work?  Are there any steps I need to follow to use it instead of the Blackberry default?
    OK, sorry., I guess I misunderstood your initial question.
    So what is NOT working.. you've installed Opera Mini and you open to use it.. what happens?
    Details, please.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How do you get the search bar back in the internet browser

    my internet browser shows my bookmarked pages, but not the space to type in websites, how do i get this to come back?

    Hmmm--doesn't sound familiar. I think you'll do better asking in the Safari forum here:
    Safari
    There are some authentic browser gurus there. Be sure to tell them the Mac OS version you are running as well as the version of Safari. You'll get faster help if they don't have to ask for those.

  • How do i update my adobe reader? as i am using internet browser 8?

    how do i update my adobe reader as i am using internet browser 8?

    In Adobe Reader use Help | Check for Updates, or download the latest Reader version from http://get.adobe.com/reader/enterprise/

  • How do you reinstall firefox on Linux without any internet browser? My boyfriend just did this and I'm trying to help him get it back.

    Firefox was playing up so he deleted it with the idea of re-installing it and obviously didn't think ahead. Now he has no internet browser, so he has no way of re-installing firefox. Does anyone have any suggestions?

    Download installer for Linux first from connected pc
    * getfirefox.com
    copy it to offline pc via any flash drive, or cd or other storage device, then install
    <br>
    See:
    * https://support.mozilla.com/en-US/kb/Installing%20Firefox%20on%20Linux

  • Help me.. To how to install a internet browser in my blackberry 9530.. help me to what i can do...

    I tried the going to the options>advance options>hosting round table> register. And that does not help. I looked up under setup also and there is no internet browser setup to try to resend service books. this is a phone but i have at&t service. I did get the blackberry data plan installed but I just am not able to use the internet or blackberry messenger. Could someone please help me this is very frustrating.

    did you link your BlackBerry Data Plan to your 9530?
    The search box on top-right of this page is your true friend, and the public Knowledge Base too:

  • How to access oracle forms from public ip through internet browser

    Dear Team,
    I have following setup:-
    We are using oracle database 11gR2
    Oracle Forms & reports : 11.1.2
    O.S : Windows 7 Professional
    I am currently accessing forms through local network through browser from server successfully.
    Now I want to access the same forms through public ip through internet browser from a remote location and not from our local network.
    I have also installed Xammp 1.7.7 apache server in the same setup computer.
    Last time I tried to access oracle through http server but xampp http port was conflicting with oracle http server so i needed to disable oracle http server for xampp apache server to work, at that time i was not needing oracle http server, now I need both. Is there any workaround to this for oracle and xampp to work at the same time in the same setup, please let me know.
    Can anybody help me to find solution for this issue.
    Thanks in Advance.

    You have to use two different -different ports for the both
    use 8080 port for the Oracle http and another for another web server.
    you can use proxy to filter the requests and redirect then to another port as per requirement.

Maybe you are looking for

  • "Attempted to read or write protected memory" error in loading a report.

    Development Environment === Windows XP Visual Studio 2008 Pro; with Crystal Reports 2008 for Visual Studio TagetCPU: 'AnyCPU' VB.net 3.5 Windows dll Crystal Reports Runtime SP2 (12.2.0.290) Deployment Environment === Windows XP .net3.5 Crystal Report

  • Printing to a Printer Connected to TIme Machine when using Remote Desktop

    Hi, I am having trouble printing to a printer connected to our wireless network via Time Capsule when I am on my remote desktop connection. Printing from all other programs work. I downloaded Bonjour on our Windows based server, and it did not detect

  • Application Server Report Path

    Dear Oracle Gurus I am new to this area of expertise. We have a peculiar problem. Let me try to explain this We are running Oracle Appication server in Windows based environment( windows server 2003 i presume) we have multiple projects running in thi

  • Uploading Logo in report program....Urgent

    Dear SDN Team Members, I'm trying to upload the logo into my report program.  I've this logo in smartform but i'm not sure how to upload that logo into my Report program. Could anyone help me send the code for the same. Thanks in Advance. Best Regard

  • Waiting in host spooler error

    Hello Friends, I recieved a request for printer setup with the below details. O/P Device name uadu001 and uadu001a both pointing to the same printer. Trays :    - Tray 2, 4 and 5 will contain A4 paper.    - Tray 3 will contain A3 paper. Printer serve