Q18. Design a Java Netbeans 6.5.1 GUI application having interface as shown below :
The loop for the frame should print numbers from lowest to highest on the basis of given two numbers, upon clicking at “Count” button.
Type the following code by double clicking jButton2, button, below the line that says, ‘// TODO add your handling code here’
num1=Integer.parseInt(jTextField1.getText()); Read More …
Q16. What method would you use, in order to simulate a button’s (namely OKBtn) click event, without any mouse activity from user’s side?
Q17.Which condition (related to container controls) every Swing GUI application must fulfill?
Ans. Every Swing GUI application must have at least one top-level container.
Q15. What command do you need to write in actionPerformed() event handler of button, in order to make it exit button?
Q14. How would you set shortcut key or access key of letter A for the button?
Ans. For setting the shortcut key or access key of a button, in its mnemonic property, we shall type:
Q13. How would you write the following text in a Label?
Ans. In the text property of the label, we shall type the following:
<html> <u> H </u> ello <BR> There.
Q12. Name the component class of panel. Also name some properties along with their purpose of this class.
Ans. The component class of a panel is JPanel. Some properties class are:
background: sets the background color of panel,
border: specifies the type of border for the panel,
toolTipText: sets the text for the toolTip.
Q11. What is a panel? What for is it mainly used?
Ans. A panel is a middle-level container that can hold a group of components.
Its main role is to group some components.
Q10. Write the purpose of following two properties of the frame i.e., JFrame type object.
- title: This property is used to set the title of the frame which is displayed on the title bar of the frame. Read More …
Q9. Name the component classes of Swing API for the following components:
- a frame
- a button
- a panel.