• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BorderLayout

 
josephine chen
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me with this one ???
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic