Sie sind auf Seite 1von 3

Java GUI Programming

Revision Tour-I
Type A Very Short/Short Answer Questions
1 What is RAD?
Ans Rapid Application Development (RAD) describes a method of developing software through the use of pre-
programming tools or wizards. The pre-programmed tools or controls are simply dropped on a screen to visually
design the interface of application.
2 What are RAD tools?
Ans RAD tools are the tool that enables one to create applications in shorter time as compared to conventional
language.
3 What is event? What is message? How is it related to an event?
Ans  An event refers to the occurrence of an activity.
 A message is the information/request sent to the application.
 Each time an event occurs, it causes a message to be sent to the operating system.
4 What are properties? What is property window?
Ans  Properties are the attributes of graphical controls.
 Properties window displays the editable settings for the currently selected component.
5 What are containers? Give examples.
Type B Short/Long Answer Questions
1 How are event, message, methods and properties interrelated?
Ans Event, message, methods and properties all are used for accomplishing the Event handling system for GUI
application. All 4 of them are interrelated with each other by this way –
Event is occurrence of something happened, when event occurred message is sent to application based on which
method takes an action which and depending on the method’s action properties are sets or gets.
2 Name at least three common controls. Also give some of their properties.
Ans 1. Label
Properties background, border, font, foreground, icon, text
2. TextField
Properties background, border, font, foreground, editable, focusable, text
3. Password Field
Properties background, font, foreground, text, echoChar
3 How are keywords different from identifiers?
Output and Error Questions
12 Find the output of the following code fragments?
(a) int s = 14;
if (s < 20)
System.out.print("under");
else
System.out.print("Over");
System.out.println("the limit.")
(b) int s = 14;
if(s < 20)
System.outprint("under");
else {
System.out.print("over");
System.out.println("the limit");
}
(c) int s = 94;
if(s < 20){
System.outprint("under");
}
Page 1 of 3
else {
System.out.print("over");
}
System.out.println("the limit");

Ans (a) Compilation Error


Correct Code
int s = 14;
if (s < 20)
System.out.print("under");
else
System.out.print("Over");
System.out.println("the limit.");
Correct Output-> underthe limit
(b) ……..

Type C Practical/Lab Questions


1 Design an application that performs arithmetic operations (+, -, *, and /). The sample screenshot is being show
below.

Ans // Addition
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int num1=Integer.parseInt(jTextField1.getText());
int num2=Integer.parseInt(jTextField2.getText());
jTextField3.setText(Integer.toString(Integer.parseInt(jTextField1.getText())+I
nteger.parseInt(jTextField2.getText())));
}
// Substraction
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
:
:
:
2 Practice – if statements. Design a GUI application having interface as shown below

Page 2 of 3
 In the left half of above interface, two numbers are to be accepted. When the user clicks at button
“Which number is larger ?”, appropriate message gets displayed in the left label.
 In the right half of above interface, a number grade is input. Valid grades are 0-4. Upon clicking the right
push button, a message depicting validity of grade is displayed in right label.

Page 3 of 3

Das könnte Ihnen auch gefallen