By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Set preferredSize of a Panel

P: n/a
Hello, I am trying to set the preferredSize of a panel but am having some
problems.

I have created a class that extends Panel and included the getPreferredSize
method (so it overides the original) which returns a new Dimension. In the
main Applet class I have used getPreferredSize() to try and call this
method.
When a try to create a getPreferredSize in the extended class, I get an
error sating cannot overide getPreferred Size? Why not?

Why does Panel only have a getPreferredSize method and not a
setPreferredSize as well.

Thanks
Andrew
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Andrew wrote:
Hello, I am trying to set the preferredSize of a panel but am having some
problems.

I have created a class that extends Panel and included the getPreferredSize
method (so it overides the original) which returns a new Dimension. In the
main Applet class I have used getPreferredSize() to try and call this
method.
When a try to create a getPreferredSize in the extended class, I get an
error sating cannot overide getPreferred Size? Why not?

Why does Panel only have a getPreferredSize method and not a
setPreferredSize as well.


Andrew,

Please post the code (as small as possible) and the error message from
the compiler. Then someone will almost assuredly be able to help.

Ray

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.