Sample Questions Best site for GRE, LSAT, SAT, GMAT, TOEFL, CCNA, CCSA and interview sample questions  

Technical Sample Questions : C |  C++ |  Oracle |  Java | Unix |  Operating Systems |  Data Structure

Java Sample Questions ›› Java AWT Sample Questions

Technical Java Sample Questions : Java AWT Sample Questions

Here we have provided some java AWT sample questions which are different from the EJB Sample Questions we referred to earlier. Let us solve them and also understand the difference between both of them.

  1. What is a Layout Manager and what are the different Layout Managers available in java.awt and what is the default Layout manager for the panel and the panel subclasses?

    Answer: A layout Manager is an object that is used to organize components in a container. The different layouts available in java.awt are:

    • FlowLayout: The elements of a FlowLayout are organized in a top to bottom, left to right fashion.
    • BorderLayout: The elements of a BorderLayout are organized at the borders (North, South, East and West) and the center of a container.
    • CardLayout: The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.
    • GridLayout: The elements of a GridLayout are of equal size and are laid out using the square of a grid.
    • GridBagLayout: The elements of a GridBagLayout are organized according to a grid.However, the elements are of different sizes and may occupy morethan one row or column of the grid.

  2. Can I add the same component to more than one container?

    Answer: No. Adding a component to a container automatically removes it from any previous parent (container).

  3. How can we create a borderless window?

    Answer: Create an instance of the Window class, give it a size, and show it on the screen.

    Frame aFrame = new Frame();
    Window aWindow = new Window(aFrame);
    aWindow.setLayout(new FlowLayout());
    aWindow.add(new Button("Press Me"));
    aWindow.getBounds(50,50,200,200);aWindow.show();

  4. Can I create a non-resizable windows? If so, how?

    Answer: Yes. By using setResizable() method in class Frame.

  5. Which containers use a BorderLayout as their default layout? Which containers use a FlowLayout as their default layout?

    Answer: The Window, Frame and Dialog classes use a BorderLayout as their default layout. The Panel and the Applet classes use the FlowLayout as their default layout.

  6. What is the difference between a MenuItem and a CheckboxMenuItem?

    Answer: The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.

Java AWT sample questions are different from J2EE Sample Questions. Given above were some java AWT sample questions for your help. Keep checking back to know more about our next entry on Java Web Development Sample Questions.

« Previous

Java AWT Sample Question Number : 1-10| 11-16
Sample Test Questions
GRE Sample Questions
CAT Sample Questions
GMAT Sample Questions
TOEFL Sample Questions
ACT Sample Questions
SAT Sample Questions
LSAT Sample Questions
PSAT Sample Questions
MCAT Sample Questions
PMP Sample Questions
GED Sample Questions
ECDL Sample Questions
DMV Sample Questions
CCNA Sample Questions
MCSE Sample Questions
Network+ Sample Questions
A+ Sample Questions
Technical Sample Questions
WASL Sample Questions
CISA Sample Questions

Other Sample Questions
Sample Interview Questions
Sample Teacher Interview Questions
Sample Citizenship Questions
Accuplacer Sample Questions
Science Bowl sample Questions
Driving Test Sample Questions
Sample Survey Questions Sample Essay Questions
Sample Behavioral Interview Questions

Copyright © 2004-2013, Best BSQ. All Rights Reserved.