-
Which of the following are true? (Select Multiple)
A) A component may handle its own events by adding itself as an event listener.B) A component may handle its own events by overriding its event-dispatching method.C) A component may not handle oits own events.D) A component may handle its own events only if it implements the handleEvent( ) method.
-
Which of the following are passed as an argument to the paint( ) method?
A) A Canvas objectB) A Graphics objectC) An Image objectD) A paint object
-
How do you indicate where a component will be positioned using Flowlayout?
A) North, South, East, WestB) Assign a row/column grid referenceC) Pass a X/Y percentage parameter to the add methodD) Do nothing, the FlowLayout will position the component
-
Which of the following layout managers honours the preferred size of a component:
A) CardLayoutB) FlowLayoutC) BorderLayoutD) GridLayout
-
The layout of a container can be altered by using which of the following methods :-
A) setLayout(aLayoutManager)B) layout(aLayoutManager)C) addLayout(aLayoutManager)D) setLayoutManager(aLayoutManager)
-
Which method is used to set the text of a Label object?
A) setText( )B) setLabel( )C) setTextLabel( )D) setLabelText( )
-
Which of the following classes have a paint( ) method? (Select Multiple)
A) CanvasB) ImageC) FrameD) Graphics
-
Which of the following components allow multiple selections? (Select Multiple)
A) Non-exclusive Checkboxes.B) Radio buttons.C) Choice.D) List.
-
How would you set the color of a graphics context called g to cyan?
A) g.setColor(Color.cyan);B) g.setCurrentColor(cyan);C) g.setColor("Color.cyan");D) g.setColor("cyan’);E) g.setColor(new Color(cyan));
-
Which TextComponent method is used to set a TextComponent to the read-only state ?
A) setReadOnly()B) setEditOnly()C) setEditable()D) setTextReadOnly()
-
Which method will cause a Frame to be displayed?
A) show( )B) setVisible( )C) display( )D) displayFrame( )
-
Which layout should you use to organize the components of a container in a tabular form?
A) CardLayoutB) BorederLayoutC) FlowLayoutD) GridLayout
-
-
What is the difference between scrollbar and scrollpane(Select Multiple)
A) Scrollbar is a component while scrollpane is a containerB) Scrollbar handles its own events while scrollpane does notC) Scrollpane handles its own events and performs its own scrolling.D) All of the above.
-
-
Which of the following may contain a menu bar?
A) A panelB) A frameC) An appletD) A menu bar
Java Swing Interview Qustions
Ans