This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Swing components

 
Ailsa Cape
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everyone.

When I use the javadoc tool to generate documents API, I find the class hierarchy of JFrame.

This question may be silly, but I am a bit confused. The JFrame class does derive from the java.awt.Component and also be in the swing package. Furthermore, in the JFrame class there are many fields and hundreds of methods which directly inherit from java.awt.Component. But my instructions state that "It must be composed exclusively with components from the Java Foundation Classes (Swing components)" and I have read the FAQ, "If a class does not inherit from the java.awt.Component, you can use it". So, can I use the JFrame class?

Thanks in advance!
Regards, Ailsa Cape
[ September 19, 2005: Message edited by: Ailsa Cape ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11854
185
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ailsa,

It looks like we need to update the FAQ - care to do it?

Basically you should not use any AWT component for which there is a Swing replacement. So in the example you have given, you should not use a Frame (AWT) because there is a JFrame (Swing).

Regards, Andrew
 
Ailsa Cape
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Andrew

Thank you again for clarifying this ambiguous issue.
This item in the instructions seems to confuse people deliberately. Now I think what the instructions want to say is just you have pointed out,

Basically you should not use any AWT component for which there is a Swing replacement.



Best Regards, Ailsa Cape
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic