• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

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.
0
InteractiveMind
Asked:
InteractiveMind
  • 6
  • 3
2 Solutions
 
aozarovCommented:
it is declared in the Component class.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
aozarovCommented:
But I think JComponent does override it:
see (from JComponent class):
public void setPreferredSize(Dimension preferredSize) {
      Dimension old = this.preferredSize;
        this.preferredSize = preferredSize;
        firePropertyChange("preferredSize", old, preferredSize);
    }
0
 
aozarovCommented:
So, I guess maybe we are using different JDK versions and in your case the delegation is to the Component class.
0
 
aozarovCommented:
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
0
 
aozarovCommented:
Oh, and Component#setPreferredSize is only since 1.5.
0
 
InteractiveMindAuthor Commented:
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.
0
 
CEHJCommented:
:-)
0
 
aozarovCommented:
:-)
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now