This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript 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.......
 
Always! Wait. Never. Shut up. Look at this tiny ad.
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!