Ajp Unit 2
Ajp Unit 2
Swings
Q1. An class listener interface and Event class Listener interface has same name.
Q5. is a superclass of all AWT events that are handled by the delegation event model.
Q7. The method returns the object that generated the event.
A) Adjustable( ) B) getModifiers( )
C) getAdjustable( ) D) getAdjust( )
Q9. Which are two ways to create Java Anonymous inner class ?
A) Class,Interface B) Class,Object
C) Interface,Object D) Class,Constructor
B) BLOCK_DECREMENT, BLOCK_INCREMENT,TRACK
C) ALT,CTRL, UNIT_INCREMENT,UNIT_DECREMENT
D) UNIT_INCREMENT,UNIT_DECREMENT,SHIFT
A) DESELECT,SELECT B) DESELECTED,SELECTED
C) ENABLED,NOTENABLED D) CHECKED,UNCHECKED
Q13. The method returns a value that indicates which modifier keys were pressed when
the event was generated.
A) getModifiers( ) B) getAdjustable( )
C) Modifiers( ) D) Adjustable( )
Q14. Whose object is to be created to show any number of choices in the visible window?
Q15. Suppose you are developing a Java Swing application and want to toggle between
various viewsof the design area. Which of the views given below are present for the users to
toggle?
A) show( ) B) setVisible( )
C) showFrame( ) D) displayFrame( )
Q18. What does the following line of code do? JTextfield text = new JTextfield(10);
A) Creates text object that can hold 10 columns of text.
Q19. The Swing component classes that are used to encapsulate a mutually exclusive set of
buttons ?
A) AbstractButton B) ButtonGroup
C) JButton D) Button
Q20. Which Swing Component classes that are used to Encapsulates a mutually exclusive set
ofbuttons?
Q21. Which method is used to add tooltip text to almost all components of Java swing?
A) getToolTipText() B) setToolTipText(String s)
C) setToolTip (String s) D) getToolTipText(String s)
A) getContent() B) getContentPane()
C) Both A & B D) getContainedPane()
Q23. Double-buffering built in, tool tips, dockable tool bars, keyboard , accelerators, custom
cursors,etc. are new features of ?
Q27. Which method of Choice class is used to return index of the selected item ?
A) getSelectedIndex() B) getSelectedIndexes()
C) getSelectedItem() D) getSelectedItems()
Q28. Swing components that don't rely on Native GUI are reffered to as
Q31. A Swing component can be viewed based on what state it's in, how it looks, and what it
does.This is known as the model-view- model
A) AbstractButton B) Button
C) Both A & B D) None of the above
A) arranges GUI components into layers such that only one layer is visible at a time
B) allows users to access a layer of GUI components via a tab
Q43. is a Swing class that allows the user to enter a multipleline of text
Q47. A array of strings is created for specifying the column headings in JTable.
A) two-dimensional B) one-dimensional
C) multi dimensional D) none of these
A) Vertical Progress Bar Only B) Horizontal Progress Bar with Progress String.
C) Horizontal and Vertical Progress Bar without progress string.
Q49. Which is correct statement from given option for using a table in an applet:
8. setVisible(true);
9. }
A) addWindowListener B) addwindow
C) WindowListener() D) addwindowlistener
Q57. Which method used to capture ALT, CTRL, META OR SHIFT keys-
A) getWhen( ) B) getActionCommand( )
C) getModifiers( ) D) getAdjustable( )
A) ItemState B) ContainerListener
C) ActionListener D) ItemListener
A) setMenu() B) setMenuBar()
C) addMenuBar() D) All of the above
A) add(component obj,FlowLayout.SOUTH);
B) add(component obj,BorderLayout.RIGHT);
C) add(component obj,BorderLayout.SOUTH);
D) add(component obj,FlowLayout.RIGHT);
Q62. is used when user wants to enter text that is not displayed,such as password.
A) t1.setEchoChar('*'); B) t1.setEchoChar("*");
C) t1.setEchoChar('**'); D) None of these
Q64. Which of the following classes in Java contains swing version of an applet?
Q66. In Java swing, which of the following components is/are represented by a rectangular
area inwhich a component may be viewed?
Q67. Swing components are ultimately derived form which of the following ?
A) javax.awt.* B) java.awt.*
C) javax.swing.JComponent D) java.swing.*
A) S B) A C) X D) J
Q69. The following are advanced components that comes with Swing except
A) 20 B) 10 C) 15 D) 5
A) JComboBox( ) B) JComboBox(Vector v)
C) JComboBox(Vector v,Vector v) D) both a & b
A) JProgressBar B) ProgressMonitor
C) ProgressMonitorInputStream D) all the above
Q74. Suppose a JFrame uses the GridLayout(2,0). If six buttons are added to the frame, how
manycolumns are displayed?
A) 1 B) 2 C) 3 D) 4
JFrame fr1=fr;
JFrame fr2=fr1;
fr.setVisible(true);
fr1.setVisible(true);
fr2.setVisible(true);
}
A) 1 B) 2 C) 3 D) 0
JLabell1=new JLabel("Password:");
f.add(value);
f.add(l1);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
Q78. Swing is a ----------------------------- , whose components are all ultimately derived from
the javax.swing.JComponent class.
A) Model-Based B) component-based framework
C) Relational Based D) None of the above
A) JCheckBoxMenuItem() B) JCheckBoxMenuItem(Action a)
C) JCheckBoxMenuItem(String text, boolean b) D) All of the above
C) A Scrollbar is handles not its own events and perform its own scrolling.
whereas Scrollpane handles not its own events and perform its own scrolling
A) String ip=java.net.InetAddress.getHostAddress();
B) String ip=java.net.InetAddress.getByName(host).getHostAddress();
C) String ip=java.net.InetAddress.getByName(host);
Q85. Which of the following GridBagLayout variable defines the external padding
(border) around thecomponent in its display area?
Q86. Which of the following GridBagLayout variables defines the padding that gets
added to each sideof the component?
Q88. Swing is the set of __________ that provides more powerful & flexible
components ascompare to Abstract Window Tooklit (AWT).
Q92. Which of the following is the Java toolkit used to write GUI programs?
A) GUI toolkit B) Abstract Windowing Toolkit
C) Graphics Event Toolkit D) Java Enhancement Toolkit
Q93. Which of the following determines how the components of a container are
displayed?
Q96. Which of the following method is used to show the specific card?
Q99. Which method is used to find out the number of rows in the grid layout?