Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INHERIT QUESTION ..Help Pliz

Status
Not open for further replies.

naruto20

Programmer
Jan 22, 2005
2
US
Hey!

My question is can the Properties of a Subclass that is inside of a SuperClass be CHANGE by another Subclass?

I have a class that is an extends of JFrame which is the Superclass and another
one that is a extends of a JPanel which is the Subclass that is inside of the Superclass. The other Subclass is one that wants to Change the setLocation of the JPanel subclass, but it doesn't do it. i can see the value of the properties but i can't change it.

If you can help me PLIZZ do : ) i been stock on this for like 2 days.
 
One thought. If the JPanel is added to the JFrame's contentPane, and that contentPane is using a LayoutManager (such as BorderLayout for example), then the setLocation won't have any effect anyway because the LayoutManager controls the positions of added components.

Tim
 
My question is can the Properties of a Subclass that is inside of a SuperClass be CHANGE by another Subclass?

I have a class that is an extends of JFrame which is the Superclass and another
one that is a extends of a JPanel which is the Subclass that is inside of the Superclass. The other Subclass is one that wants to Change the setLocation of the JPanel subclass, but it doesn't do it. i can see the value of the properties but i can't change it.

subclass is a class that is Derived using extends or implements.

a class inside another class is a nested class. If I take what you say literally I get this:

Code:
public class A extends JFrame
{
   //stuff here
   public class B extends A
   {
   }
}

Note that B is an A and A is a JFrame, so B is a JFrame. So inside B I have to be very carful about wether I'm talking about my members I inherited from A or if I am talking about B's parent object's members.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top