InteractiveMind
asked on
setPreferredSize( Dimension ) ?
Hi,
in what class is the setPreferredSize(Dimension ) method declared (furthest up the hierachy)?
Because, I traced it down to: javax.swing.JComponent. However, that method has the following:
public void setPreferredSize( Dimension dim )
{
super.setPreferredSize( dim );
}
However, the class that JComponent extends: Component, doesn't seem to have a declaration for setPreferredSize() !?
Where is it?
Thanks,
Rob.
in what class is the setPreferredSize(Dimension
Because, I traced it down to: javax.swing.JComponent. However, that method has the following:
public void setPreferredSize( Dimension dim )
{
super.setPreferredSize( dim );
}
However, the class that JComponent extends: Component, doesn't seem to have a declaration for setPreferredSize() !?
Where is it?
Thanks,
Rob.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
But I think JComponent does override it:
see (from JComponent class):
public void setPreferredSize(Dimension preferredSize) {
Dimension old = this.preferredSize;
this.preferredSize = preferredSize;
firePropertyChange("prefer redSize", old, preferredSize);
}
see (from JComponent class):
public void setPreferredSize(Dimension
Dimension old = this.preferredSize;
this.preferredSize = preferredSize;
firePropertyChange("prefer
}
So, I guess maybe we are using different JDK versions and in your case the delegation is to the Component class.
Which version of Swing are using?
I checked back and even with the Swing that comes with JDK 1.3 JComponent provides the implementation and doesn't call super.setPreferredSize
I checked back and even with the Swing that comes with JDK 1.3 JComponent provides the implementation and doesn't call super.setPreferredSize
Oh, and Component#setPreferredSize is only since 1.5.
ASKER
Thanks very much both..
lol -- I have no idea how, but, I just checked the Component.java class again, and I found the declaration for setPreferredSize(Dimension preferredSize) !! :o\
(Yeah, I'm using 1.5).
How strange; I have no idea how I missed it. lol.
Sorry!!
Point split. :-)
Regards;
Rob.
lol -- I have no idea how, but, I just checked the Component.java class again, and I found the declaration for setPreferredSize(Dimension
(Yeah, I'm using 1.5).
How strange; I have no idea how I missed it. lol.
Sorry!!
Point split. :-)
Regards;
Rob.
:-)
:-)
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setPreferredSize(java.awt.Dimension)