Results are out! Find what you Get quick advice or join the chat
Hey! Sign in to get help with your study questionsNew here? Join for free to post

Java and Flickr - Help with Inheritance between Main Class and sub-class

Announcements Posted on
Let our uni choice search tool match you with your perfect university 19-11-2015
  1. Offline

    Dear all,

    I have been doing a small program which can help user search general photos by keywords and can retrieve most recent general uploads from Flickr.

    I created 4 classes:

    testUserInterface => to build all components for interface.

    testSearch => inherits interface from testUserInterface and build event action when user clicks on button start and button exit.

    PhotoFinder => get connection to Flickr.

    Link to view my code of PhotoFinder

    PhotoPanel => displays photos on this panel.

    Link to view my code of PhotoPanel

    When I select sub-menu "Search Photos" from class testUserInterface, a search panel is displayed with textfield and 2 buttons, start and exit.

    However, a problem occurs when I clicks start button (after entering a specific keyword).
    all photos which relates to the keyword is not shown.
    and I got problem with sub-menu instead in line 180.

    The errors are shown below:

    PHP Code:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastExceptionjavax.swing.JButton cannot be cast to javax.swing.JMenuItem at testUserInterface.actionPerformed(testUserInterfac javax.swing.AbstractButton.fireActionPerformed(Abs javax.swing.AbstractButton$Handler.actionPerformed ( javax.swing.DefaultButtonModel.fireActionPerformed ( javax.swing.DefaultButtonModel.setPressed(DefaultB javax.swing.plaf.basic.BasicButtonListener.mouseRe leased( java.awt.Component.processMouseEvent(Component.jav a:6505at javax.swing.JComponent.processMouseEvent(JComponen java.awt.Component.processEvent( 0at java.awt.Container.processEvent( 9at java.awt.Component.dispatchEventImpl(Component.jav a:4861at java.awt.Container.dispatchEventImpl(Container.jav a:2287at java.awt.Component.dispatchEvent( 87at java.awt.LightweightDispatcher.processMouseEvent(C java.awt.LightweightDispatcher.dispatchEvent(Conta java.awt.Container.dispatchEventImpl(Container.jav a:2273at java.awt.Window.dispatchEventImpl( at java.awt.Component.dispatchEvent( 87at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:723at java.awt.EventQueue.access$200( at java.awt.EventQueue$ java.awt.EventQueue$ Methodat$1.doIntersectionPri vilege($1.doIntersectionPri vilege( java.awt.EventQueue$ java.awt.EventQueue$ Methodat$1.doIntersectionPri vilege( java.awt.EventQueue.dispatchEvent(EventQueue.java693at java.awt.EventDispatchThread.pumpOneEventForFilter s( java.awt.EventDispatchThread.pumpEventsForFilter(E java.awt.EventDispatchThread.pumpEventsForHierarch y( java.awt.EventDispatchThread.pumpEvents(EventDispa java.awt.EventDispatchThread.pumpEvents(EventDispa
    Please help me out with the problem, it drives me crazy (TT)


Submit reply


Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide to join now Processing…

Updated: December 14, 2012
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Today on TSR

Applying to uni

The latest advice and trending discussions are all here

What's your favourite kitchen utensil?
Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.