Bookmark Topic Watch Topic
  • New Topic

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

 
Hung Pham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 5133
11
Java Netbeans IDE Opera
 
Hung Pham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hung Pham wrote:Could admin remove this topic please, . .
No. We do not remove posts as a routine.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic