This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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
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
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