-
An application has a frame that uses a Border layout manager. Why is it probably not a good idea to put a vertical scroll bar at North in the frame?
A) The scroll bar’s height would be its preferred height, which is not likely to be enough.B) The scroll bar’s width would be the entire width of the frame, which would be much wider than necessary.C) Both a and b.D) Neither a nor b. There is no problem with the layout as described.
-
-
All Applets are subclasses of Applet.
A) TrueB) False
-
Which of the following are direct or indirect subclasses of Container? (Select Multiple)
A) FrameB) TextAreaC) MenuBarD) FileDialogE) Applet
-
-
All Applets must import java.applet and java.awt.
A) TrueB) False
-
Which of the following option(s) doesn’t correctly describe the Applet’s Life Cycle methods?
A) init( ) method - Can be called when an applet is first loaded.B) start( ) method - Can be called each time an applet is started.C) paint( ) method - Can be called when the applet is minimized or refreshed.D) destroy( ) method - Can be called when the browser moves off the applet’s page.Explanation: it is the explanation for stop(), while destroy( ) method - Can be called when the browser is finished...
-
You have created a simple Frame and overridden the paint method as follows public void paint(Graphics g){ g.drawString("Dolly",50,10);}What will be the result when you attempt to compile and run the program?
A) The string "Dolly" will be displayed at the centre of the frameB) An error at compilation complaining at the signature of the paint methodC) The lower part of the word Dolly will be seen at the top of the form, with the top hidden.D) The string "Dolly" will be shown at the bottom of the form
-
Which of the following statement(s) are true?
A) The default layout manager for an Applet is FlowLayoutB) The default layout manager for an application is FlowLayoutC) A layout manager must be assigned to an Applet before the setSize method is calledD) The FlowLayout manager attempts to honor the preferred size of any components
-
Which of the following methods are defined on the Graphics class:
A) drawLine(int, int, int, int)B) drawImage(Image, int, int, ImageObserver)C) drawString(String, int, int)D) add(Component);E) setVisible(boolean);F) setLayout(Object);
-
-
Heavyweight componants are not handled properly when they are placed inside the JScrollpane’s viewport because(Select Multiple)
A) JScrollPane is a lightweight component.B) Viewport of JScrollPane which clips its scrollable child, is lightweightC) None of the aboveD) Either of the above.
-
Fill in the blanks :- The highest-level event class of the event-delegation model is _____
A) java.util.eventObject
-
Fill in the blank :- the default look and feel of a swing component is _____________
A) Java Look and Feel
-
-
A text field has a variable-width font. It is constructed by calling new TextField("iiiii"). What happens if you change the contents of the text field to "wwwww"? (Bear in mind that is one of the narrowest characters, and w is one of the widest.)
A) The text field becomes wider.B) The text field becomes narrower.C) The text field stays the same width; to see the entire contents you will have to scroll by using the ß and à keys.D) The text field stays the same width; to see the entire contents you will have to scroll by using the text field’s horizontal scroll bar.
-
What are the immediate super classes of the following classes? (Select Multiple)
A) Container - ComponentB) MenuComponent - ObjectC) Dialog - WindowD) Applet - Panel
-
What are the borders provided by swings (Select Multiple)
A) SimpleB) MatteC) TitledD) AggregateExplanation: the fourth one is Compound
-
Lightweight components differ from heavy weight componants not because of one of the following reasons
A) A heavyweight component have transparent pixels which lightweight have opaque.B) A lightweight can appear to be non-rectangular while heavyweight are always rectangular.C) Mouse events on light weight componants fall through its parents while in the heavyweight it doesn’t.D) On overlapping of the lightweight component over the heavy weight component the heavy weight component is always on top.Explanation:...
-
Which of the following are true? (Select Multiple)
A) The AWT automatically causes a window to be repainted when a portion of a window has been minimized and then maximized.B) The AWT automatically causes a window to be repainted when a portion of a window has been covered and then uncovered.C) The AWT automatically causes a window to be repainted when application data is changed.D) The AWT does not support repainting operations.
Java Swing Interview Qustions
Ans