Java AWT Basics Quiz
31 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

AWT means?

  • Abstract Windows Toolkit (correct)
  • Advanced Web Technology
  • Abstract Web Toolkit
  • Advanced Web Toolkit
  • Which is the immediate super class of Applet?

  • Frame
  • Container
  • Panel
  • Component (correct)
  • The setSize( ) method is defined by this class…

  • Frame
  • Panel
  • Component (correct)
  • Applet
  • Which class encapsulates a blank window upon which we can draw?

    <p>Canvas</p> Signup and view all the answers

    What are the variables defined in ‘Dimension’ class?

    <p>height and width</p> Signup and view all the answers

    If we want to hide the window, we can use this method…

    <p>setVisible( )</p> Signup and view all the answers

    Color class can create an object of it using which of the following color values?

    <p>RGB</p> Signup and view all the answers

    The setColor( ) is the method of which class?

    <p>Graphics</p> Signup and view all the answers

    Which of the following style is not supported by Font class?

    <p>Font.UNDERLINE</p> Signup and view all the answers

    All the AWT controls are subclasses of which class?

    <p>Component</p> Signup and view all the answers

    How can you remove all the controls from the applet?

    <p>Using removeAll( ) method</p> Signup and view all the answers

    Which of the following is a passive AWT control?

    <p>Label</p> Signup and view all the answers

    Which alignment is not supported by Label?

    <p>Label.BASELINE</p> Signup and view all the answers

    How can we create Radio buttons?

    <p>Using CheckboxGroup class</p> Signup and view all the answers

    How to add the names in choice controls?

    <p>Using addItem( ) method</p> Signup and view all the answers

    Multiple selections are allowed in…

    <p>List</p> Signup and view all the answers

    How can we copy the ‘List’s contents into ‘Choice’s contents?

    <p>Using copyInto( ) method of List</p> Signup and view all the answers

    What is the default block-increment of Scrollbar?

    <p>10</p> Signup and view all the answers

    The immediate super class of TextArea is…

    <p>TextComponent</p> Signup and view all the answers

    Is it possible to change display character of TextField? How?

    <p>Yes, by using setEchoChar( ) method</p> Signup and view all the answers

    Is it possible to center the text typed in TextField? How?

    <p>Yes, by using setAlignment( ) method</p> Signup and view all the answers

    Which method is used to append the text at the end of TextArea?

    <p>append( )</p> Signup and view all the answers

    FlowLayout does not support this value of alignment…

    <p>FlowLayout.BASELINE</p> Signup and view all the answers

    The setLayout( ) is the method of which class?

    <p>Applet</p> Signup and view all the answers

    BorderLayout does not support this value of alignment…

    <p>BorderLayout.MIDDLE</p> Signup and view all the answers

    The correct constructor of Insets( ) which uses the values is…

    <p>Insets(int top, int left, int bottom, int right)</p> Signup and view all the answers

    The various controls supported by AWT are?

    <p>All of these</p> Signup and view all the answers

    The concept of the menu bar can be implemented by using three Java classes—

    <p>All of these</p> Signup and view all the answers

    The most commonly used layout managers are?

    <p>All of these</p> Signup and view all the answers

    The constructor which the Text Event class defines is?

    <p>TextEvent(Object source, int event_type)</p> Signup and view all the answers

    In Java, an event is an __________ which specifies the change of state in the source.

    <p>object</p> Signup and view all the answers

    Study Notes

    AWT and Applet Concepts

    • AWT stands for Abstract Windows Toolkit, used for creating graphical user interfaces in Java.
    • The immediate superclass of Applet is Container, which allows it to hold other components.
    • SetSize() method is defined in the Component class and is used to set the size of a component.

    Drawing and Dimensions

    • The Canvas class encapsulates a blank window suitable for drawing graphics.
    • The Dimension class defines variables for width and height, fundamental for layout and sizing in GUI applications.

    Window Management

    • To hide a window in AWT, use the setVisible() method.
    • Color creation in AWT can utilize RGB values through the Color class.

    Graphics and Fonts

    • SetColor() is a method of the Graphics class, allowing color changes for drawing.
    • Font class supports styles like Font.ITALIC, Font.PLAIN, and Font.BOLD, but does not support Font.UNDERLINE.

    AWT Controls

    • All AWT controls are subclasses of the Component class, which is essential for GUI components in Java.
    • To remove all controls from an applet, use the removeAll() method effectively.

    Control Types and Properties

    • The Label class is a passive AWT control that displays text without user interaction.
    • The Label class does not support Label.BASELINE alignment.
    • Radio buttons can be created using CheckboxGroup class to group multiple options.

    Choice Controls and List Functions

    • Items in choice controls are added using the addItem() method.
    • A List allows multiple selections, making it suitable for scenarios requiring several inputs.
    • Copying contents from a List to a Choice is done using the copyInto() method.

    Scrollbar and Text Fields

    • The default block increment for Scrollbar is 10.
    • The immediate superclass of TextArea is TextComponent, which allows scrolling text fields.
    • TextField display characters can be changed using the setEchoChar() method, and text alignment can be set using setAlignment().

    Layout Managers

    • FlowLayout does not support FlowLayout.BASELINE alignment, while BorderLayout lacks support for the BorderLayout.MIDDLE alignment.
    • The setLayout() method is part of the Container class, allowing layout management for composites of components.

    Insets and Menu Implementation

    • Insets are specified using Insets(int top, int left, int bottom, int right) constructor, defining the space around components.
    • A menu bar is implemented using MenuBar, Menu, and MenuItem classes collectively.

    Event Handling in Java

    • The TextEvent class has a constructor defined as TextEvent(Object source, int event_type) to handle text-related events.
    • An event signifies a change of state in Java, represented as an Object associated with the source of the change.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    AJP_1_Ans.pdf

    Description

    Test your knowledge on the Abstract Window Toolkit (AWT) and its components in Java. This quiz covers fundamental concepts such as superclasses of applets and method definitions. Perfect for students of the AJP course looking to solidify their understanding of AWT.

    More Like This

    AWT Quiz
    10 questions

    AWT Quiz

    OutstandingSanctuary avatar
    OutstandingSanctuary
    Java AWT Controls and Menus Quiz
    5 questions
    Java GUI Components: AWT and Swing
    30 questions
    Java AWT Components Quiz
    8 questions

    Java AWT Components Quiz

    WellRegardedMagicRealism avatar
    WellRegardedMagicRealism
    Use Quizgecko on...
    Browser
    Browser