File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Java and Flickr - Help with Inheritance between Main Class and sub-class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

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

Hung Pham
Greenhorn

Joined: Dec 12, 2012
Posts: 3
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.

Link to view my code of testUserInterface



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

Link to view my code of testSearch



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.



Please help me out with the problem, it drives me crazy (TT)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
The Exception tells it all. You are trying to cast a JButton to a JMenuItem, which you cannot do. They are different classes. Why do you want such casts in the first place?

And welcome to the Ranch
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4527
    
    5

Hung Pham, if you didn't understand my response on Java and Flickr - Help with Inheritance between Main Class and sub-class you should have asked for clarification. For your future reference, please BeForthrightWhenCrossPostingToOtherSites <- click the link

edit Also on http://www.thestudentroom.co.uk/showthread.php?t=2200593

edit2: Two more: http://www.javaprogrammingforums.com/whats-wrong-my-code/20461-java-flickr-help-inheritance-between-main-class-sub-class.html
http://forums.devshed.com/java-help-9/java-and-flickr-help-with-inheritance-between-main-class-and-sub-class-936103.html


luck, db
There are no new questions, but there may be new answers.
Hung Pham
Greenhorn

Joined: Dec 12, 2012
Posts: 3
Thank you to Campbell Ritchie,

I am quite new to Java and got help with getActionCommand() from another mate.

@Darryl Burke

Sorry, I did not notice about "Be Forthright When Cross Posting To Other Sites" from java-forums.org

I thought all website run individually and much faster If I post the same question in different 4rums.

Sorry in advance
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
Hung Pham wrote:Thank you to Campbell Ritchie,

I am quite new to Java and got help with getActionCommand() from another mate.
. . .
Did you say help? If you have been told to use a great big actionPerformed method with lots of if statements, that is not help at all. You should be linking different Listeners to different buttons. Work out how to do it with one Listener per button, then you can help him back. And it will really be help

This discussion would fit better in our GUIs forum: moving.
Hung Pham
Greenhorn

Joined: Dec 12, 2012
Posts: 3
Could admin remove this topic please, it is not needed any more and it is also crossing post with other 4rums.

thanks a lot
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
Hung Pham wrote:Could admin remove this topic please, . .
No. We do not remove posts as a routine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java and Flickr - Help with Inheritance between Main Class and sub-class