Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

[highlight]https://www.dropbox.com/s/jq4g4pe32fkr3og/testUserInterface.java [/highlight]



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

https://www.dropbox.com/s/0vz2k9fcuo2kh2y/testSearch.java



PhotoFinder => get connection to Flickr.

Link to view my code of PhotoFinder

https://www.dropbox.com/s/715u81j3yvpjeqv/PhotoFinder.java



PhotoPanel => displays photos on this panel.

Link to view my code of PhotoPanel

https://www.dropbox.com/s/tc9l7nwx5snw0go/PhotoPanel.java



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)
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Hung Pham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Hung Pham wrote:Could admin remove this topic please, . .

No. We do not remove posts as a routine.
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic