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 4 of 4

Thread: Event handling

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Event handling

    can anyone explain how these blocks of code works?
    this code is working code. but i cant understand how the event handling is implemented in this code
    forwardButton is an instance of JButton and the main container class doesnt implement ActionListerner interface

    forwardButton.addActionListener(new ActionListener(){
    public void actionPerformed( ActionEvent event )
    {
    URL url= webBrowserPane.forward();
    urlTextField.setText(url.toString());
    }
    });
    Last edited by noobjava; May 19th, 2014 at 06:47 AM.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Event handling

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    The code includes an "anonymous inner class" to perform the event handling which you should find more about with a web search.

  3. #3
    Junior Member
    Join Date
    May 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Event handling

    thanks. i know i am not much clear. i'll try to learn more and then ask.
    Last edited by noobjava; May 19th, 2014 at 06:48 AM.

  4. #4
    Junior Member
    Join Date
    May 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Event handling

    I got the answer to my question.. Its the implementation of inner class for event handling that i was unable to understand

Similar Threads

  1. Event Handling Styles
    By beer-in-box in forum AWT / Java Swing
    Replies: 4
    Last Post: March 6th, 2013, 09:06 PM
  2. Event Handling
    By maress in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 24th, 2011, 03:29 AM
  3. [SOLVED] JRadioButton Event Handling Help?
    By CS313e in forum AWT / Java Swing
    Replies: 2
    Last Post: March 27th, 2010, 11:56 AM
  4. JButton event handling.
    By Prof in forum AWT / Java Swing
    Replies: 6
    Last Post: February 3rd, 2010, 10:29 AM
  5. Event handling
    By subhvi in forum AWT / Java Swing
    Replies: 3
    Last Post: August 26th, 2009, 11:20 AM

Tags for this Thread