Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: WHATS WRONG WITH MY CODE? PLEASE CORRECT IT.

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default WHATS WRONG WITH MY CODE? PLEASE CORRECT IT.

    Hello, I am new to java coding and i am 13 i have been trying to make a simple web browser and i have finished my code but it doesn't seem to be working can you correct it please,

    package com.LewisBelton.BellyBrowser;

    import java.awt.BorderLayout;

    import javax.swing.*;
    import javax.swing.event.HyperlinkEvent;

    public class Browser extends JFrame
    {
    JTextField url;
    JEditorPane page;

    public Browser()
    {
    super("BellyBrowser");

    url = new JTextField("Enter URL Here.");
    url.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent event)
    {
    loadPage(event.getActionComand());
    }
    }
    );
    page = new JEditorPane();
    page.setEditable(false);
    page.addHyperLinkListener(
    new HyperLinkListener()
    {
    public void hyperlinkupdate(HyperlinkEvent event)
    {
    if(event.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
    {
    loadPage(event.getURL().toString);
    }
    }
    }
    );
    add(url, BorderLayout.NORTH);
    add(new JScrollPane(page), BorderLayout.CENTER);
    setSize(1000, 700);
    setResizable(true);
    setVisible(true);
    }

    private void loadpage(String pageURL)
    {

    try
    {
    page.setPage(pageURL);
    url.setText(pageURL);
    }
    catch(Exception e)
    {
    System.out.println("Website Not Found");
    }
    }
    }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: WHATS WRONG WITH MY CODE? PLEASE CORRECT IT.

    WHATS WRONG WITH MY CODE?
    First, there is no reason to shout. Second, you might have more constructive feedback by telling us - does it compile? Are there exceptions? Does it misbehave? Lastly, please wrap all code with the code tags

Similar Threads

  1. Whats wrong with my code?
    By mhphucld in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 26th, 2013, 08:50 PM
  2. hi if u can help me please whats wrong with this code
    By ohad in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 8th, 2013, 02:04 PM
  3. Can someone see whats wrong with my code, please?
    By DJBENZ10 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 11th, 2012, 08:54 PM
  4. Whats wrong with my code!!
    By nitwit3 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 22nd, 2011, 11:45 AM