• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

java.awt what is going on???

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can some one please explanin how this is being done. I always thought of drawing diagrams of the the topmost container holding the innermost container. Also the top most container in this code is FlowLayout defaulting it to LEFT, then a panel p1 with FlowLayout, panel p2 with BorderLayout and panel p3 with GridLayout. What I am asking is if this kindda question comes in java cert what is the best way to approach it??
Also I have added the Color to each container, however I never see Color.black??? Why


Thanks in advance for your help!!!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't see any black background in panel p2 because it does not have anything in it except the panel p1, - the south position fills the entire layout.
The use of the word "topmost" is confusing - we speak of the top-level container which contains all the other stuff, or the component "on top" which means the one exposed to the user - as opposed to hidden by something else.
Bill
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill
I want to know given the code how would YOU have interpreted the code?? Basically I wanna know the sequence of this code.
I will be careful not to use top leve container
Thanks
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill
I want to know given the code how would YOU have interpreted the code?? Basically I wanna know the sequence of this code.
I will be careful not to use top leve container
Thanks
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amish :
I believe there _may_ be similar questions on the real certification exam - there will be several containers, one inside the other and there will be a question on the appearance of one of the components.
The best way to do this is to do it in two passes. In the first pass, just draw each of the containers with their respective layout managers.
So for this example you will have three rectangles P1, P2 and P3 with flow , border and grid layouts respectively. Remember to mark any font and back/foreground color settings as well.
In the second pass draw all the components within these containers.
So the button gets added to P1,then P1 gets added to P2 and P2 gets added to P3. You can just use arrows do denote that P3 contains P2 which contains P1. No need to really redraw the three panels.
Finally add P3 to the frame and you have a complete picture of what the code is trying to do.
Hope this helps
reply
    Bookmark Topic Watch Topic
  • New Topic