File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a question about the restriction to the assignment

 
Ben Zung
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It says: "It must be composed exclusively with compoments from the JFC(Swing)". What about the non-component? What I means is if I want to set the layout for a JPanel. the one I want to use, BorderLayout is in awt package, is it ok to use it?
Thanks.
Bing
 
George Marinkovich
Ranch Hand
Posts: 619
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bing,
Welcome to this forum.
Originally posted by Bing Yuen:
It says: "It must be composed exclusively with compoments from the JFC(Swing)". What about the non-component? What I means is if I want to set the layout for a JPanel. the one I want to use, BorderLayout is in awt package, is it ok to use it?

BorderLayout is fine. If there's a JComponent available then you should use it rather than a Component. For example, use JFrame instead of Frame, use JLabel instead of Label, etc. There's a good number of classes that we need to use from the old AWT because Swing does not provide an alternative. Where there's no alternative to AWT you can use AWT, where there's a Swing alternative you should use the Swing component.
[ March 25, 2004: Message edited by: George Marinkovich ]
 
Ben Zung
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
George:
Thanks for the "welcome" and your explanation. It is very good and helpful to know that.
Again, thank you.
Bing
 
Denis Spirin
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm... I have same question. It is said:
it must be composed exclusively with components from the JFC(Swing)

You say:
Where there's no alternative to AWT you can use AWT, where there's a Swing alternative you should use the Swing component.

In fact, there is some alternative to AWT layouts, such as BoxLayout, SpringLayout, etc.
Does Sun mean "components" or "Components" (which extend JComponent)?
In my assignment I use GridLayout and GridBagLayout. Is it ok?
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Denis
Originally posted by Denis Spirin:
In my assignment I use GridLayout and GridBagLayout. Is it ok?

I think its OK to use them. I remember Ken used GridBagLayout and he got great score.
 
Denis Spirin
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic