This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LayoutManager

 
josephine chen
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. }

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

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

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

d) Five push buttons are drawn, with the largest push button in the center. //t

e) The code compiles successfully //t

 
josephine chen
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Statement 2 is ignored and the default Layout Manager for an Applet is used. //f
b) There is a compile error on line 6: you cannot mix the use of Strings and Constants to specify the location of components. //f
c) There is a compile error on line 8: the location specification via a String or Constant is not provided. //f
d) Five push buttons are drawn, with the largest push button in the center. //f
e) The code compiles successfully //t
add(BorderLayout.NORTH, new Button("North"));
add(new Button("North"),BorderLayout.NORTH);
add("North", new Button("North"));
are same.......
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic