Tutorial 2
[Link] package is used for Swing components in Java?
a) [Link] b) [Link] c) [Link] d) [Link]
[Link] Swing component is used to create a button?
a) JLabel b) JRadioButton. c) JButton d) JTextArea
[Link] Swing component is used to display a list of items with a
single selection?
a) JComboBox b) Jlist c) JTable d) JCheckBox
[Link] Swing component is used to create a tabbed pane?
a) JTabbedPane b) JTabComponent c) JTabView. d) JTabControl
[Link] method is used to set the text of a JLabel in Swing?
a) setText() b) setTextLabel() c) setLabel() d) setTextValue()
[Link] do you make a Swing component visible on the screen?
a) setVisible(true) method. b) show() method c) display() method. d)
open() method
[Link] do you add components to a JFrame in Swing?
a) addComponent() method b) append() method c) insertComponent()
method d) add() method
[Link] class is used to create a check box in Swing?
a) JCheckBox b) JRadioButton c) JToggleButton d) JCheckButton
[Link] do you set the size of a JFrame in Swing?
a) setSize() b) setDimension() c) setWidthHeight() d) setBounds()
[Link] class is used to display an image in Swing?
a) ImageDisplay b) ImageViewer. c) ImageIcon d) ImagePanel
[Link] component is used to display a tooltip when the mouse
hovers over it?
a) JToolTip b) JPopup. c) JTooltipPane d) JPopupTip
[Link] Components in JApplet are added to
a) Current JApplet Class b)ContentPane. c)Both A and B d) None
[Link] many Options can be selected in JRadioButton at a time?
a) Only One b) Multiple c)It is defined in the program d)Only a
maximum of six
14.A tree represent a __________ view of data.
a) Structural. b)Hierchical c)Multiple d) Single
[Link] of the following alignment is not possible for JLabel ?
a) TOP. b) LEFT c) CENTER d) LEADING
[Link] stands for ____
a) Model Version Control. b) Model View Controller.
c)Mini View Controller. d)Major View Controller.
[Link] is the purpose of JTree?
a). To show data in the form of parent and child nodes. b). To show data
in list view .
c)To show data in tabular form. d). To show data in menu-bar .
[Link] of the following architecture does the swing framework
use ?
a) MVC b) MVP c) Layered Architecture d) Master-slave Architecture
[Link] of these methods cannot be called on JLAbel object?
a)setIcon() b)getText() c)setLabel() d)setBorderLayout()
[Link] components are ______________ .
a)Platform dependent b)Platform independent c)Both A & B d)Platform
oriented
[Link] is the return type of getText() method of JButton class?
a)Void b)String c)Character Array d)There is no such metho
[Link] Orientation of progress bar is _________________ .
a)Horizontal b)Vertical c)Both A and B d)None of these
[Link] class is present in which packages?
a)[Link].*; b)[Link].*; c)[Link].*; d)[Link].*;
[Link] is based on ______________ architecture.
a)Client Server b)Model View Controller c)Layered d)None of these
[Link] swing, Buttons are subclasses of which class?
a) AbstractButton b) JButton c) Button d) JRadioButton
[Link] component is swing represents data in row and columns?
a) JTextArea b) JTable c) JPanel d) JtabbedPane
27.___________class used to create node in tree.
a) TreeNode b) DefaultMutableNode c) DefaultMutableTreeNode d)
Node
[Link] of the following method is not applicable for Button in
swing.
a) setDiableIcon() b) setPressedIcon() c) setSelectedIcon() d)
setRollOverIcon()
[Link] following list which is not Swing class?
a) JLabel b) JButton c) JImageIcon d) JCheckBox
[Link] Swing, the content pane can be obtained via the method:
a) getContentPane() b) fetchContentPane() c) retrieveContent() d)
accessContent()
[Link] Swing, what component is used for adding hints to other
Swing components to provide additional information?
A. JToolTip B. JLabel C. JTextField D. JTabbedPane
[Link] is the Swing check box class.
a) JCheckbox b) JSCheckbox c) JCheckBox d) None
[Link] event is generated when a JButton is pushed?
a) ItemEvent b) TextEvent c) PushEvent d) ActionEvent
[Link] can we create Radio buttons in Swing?
a) Using ButtonGroup class b) Using JCheckboxGroup class c) Using
JRadioButton class d) Using JButton class
[Link] of the following constants shows scroll bars always?
a) HORIZONTAL_SCROLLBAR_ALWAYS b)
HORIZONTAL_SCROLLBAR_AS_NEEDED c)
HORIZONTAL_SCROLLBARS
d) HORIZONTAL_ALWAYS
[Link] are added by calling
a) getTab() b) setTab() c) addTab() d) all of these
[Link] will be the correct statement if you want a checkbox to be
checked by default?
a) JCheckBox jc= new JCheckBox(String s, boolean checked)
b) JCheckBox jc= new JCheckBox(String s, boolean false)
c) JCheckBox jc= new JCheckBox(String s, boolean unchecked)
d) JCheckBox jc= new JCheckBox(String s, boolean true)
[Link] is the correct syntax for constructor of JRadioButton?
a) JRadioButton(Icon i, String s, boolean state)
b) JRadioButton(String s, Icon i, boolean state)
c) JRadioButton(Icon i,boolean state, String s, )
d) d)JRadioButton(boolean state, String s, Icon i)
[Link] _____________ determines how the component reacts to the
user
a) View b) Controller c) User d) Model
[Link] The Error :
import [Link].*;
public class FirstSwingExample{
public static void main(String[] args) {
JFrame f=new JFrame();
JButton b=new JButton("click");
[Link](130,100,100, 40)
[Link](b);
[Link](400,500);
[Link](null);
}}
A) No Error B) Set Visible Method is not defined C) Button is not added
on Frame D) inside main method error