File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes BorderLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "BorderLayout" Watch "BorderLayout" New topic


josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
1. public LayoutApplet ( ) {
2. setLayout(new BorderLayout());
3. setFont(new Font("Serif", Font.PLAIN, 14));
4. add(BorderLayout.NORTH, new Button("North"));
5. add(BorderLayout.SOUTH, new Button("South"));
6. add("East", new Button("East"));
7. add("West", new Button("West"));
8. add(new Button("Center"));
9. }

a) Five push buttons are drawn, with the largest push button in the center. ???
largest is center one becoz of the word "center" which is
six letter word .So appears slightly larger than others

b) There is a compile error on line 8: the location specification via a String or Constant is not provided. //f

c) There is a compile error on line 6: you cannot mix the use of Strings and Constants to specify the location of components.//f

d) Statement 2 is ignored and the default Layout Manager for an Applet is used. //f

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
please help me with this one ???
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
You can check your answer yourself by compiling and running the program. You'll need to add some stuff, since this seems to be just the constructor. How about:

I used a Frame instead of an Applet because that's what I'm more familiar with - it shouldn't make a difference in the answer.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: BorderLayout
It's not a secret anymore!