Header Ads

  • Breaking Now

    Short Questions And Their Answers

    What is the difference between the paint() and repaint() methods?
    The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.

    What are different container classes?
    Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane

    Which Container method is used to cause a container to be laid out and redisplayed?

    Name Component subclasses that support painting.
    The Canvas, Frame, Panel, and Applet classes support painting.

    Which containers use a border layout as their default layout?
    The following classes use BorderLayout as their default layout:

    Which containers use a FlowLayout as their default layout?
    The classes in java.awt.* package: Panel and Applet
    While in javax.swing.* package: JPanel and JApplet use FlowLayout as their default layout.

    What is the purpose of class Canvas?
    A Canvas object represents a blank,semantics free window upon which you can draw.It is not part of the hierarchy of applet or frame window.It has general GUI component for drawing images and text on the screen. It does not support any drawing methods on its own, but provides access to a Graphics object through its paint() method. Whenever paint() is invoked during creation and update of a canvas , the Graphics object associated with a Canvas object gets updated.

    Difference between Canvas class and Graphics class?
    A Canvas class is a blank,semantics free window upon which you can draw while Graphics class encapsulates the graphics context. This context is used by the various output methods to display output in a window.

    Post Top Ad

    Post Bottom Ad