• Post Reply 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

How do I make a subclass known at the top level class?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't want to change my code because I'm in a tight deadline.

I defined a subclass within another class but then I found out that I really need the subclass to be known at the top level because I need to control it's MouseListeners at the top level.

How to I return a CardLabel() class that is defined within HandPanel() class to the top level class?

CardLabel() class is NOT an instance of HandPanelPanel(). Instead it is subclass. I need the CardLabel() class to be known in the top level class so that I can control it in the Controller().

I'm so exhausted. I don't want to have change the way I have it but I need to controller the action of onclick.

public class HandPanel extends JPanel

public HandPanel(){

}



private class cardLabel extends JLabel implements MouseListener{

....

}

}


Please help. I'm stuck and haven't slept
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your description is a bit wishy-washy, but maybe this will give you some idea

 
Grow your own food... or this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic