• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Ana Suvari
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • 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
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your description is a bit wishy-washy, but maybe this will give you some idea

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!