Assignment of CH-3 (GUI Programming-A Review) Class-XII Informatics Practices

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Assignment of CH-3(GUI Programming-A Review)

Class-XII
Informatics Practices

1. Name any 5 elements of Java IDE Window.


1. Title Bar
2. Menu Bar with pull down menus
3. Toolbars
4. GUI builder: It is an area to place components on the form visually.
There are two views of the GUI builder- the Design View and the Source
View. We can switch over from one view to another by simply clicking on
the source and design tabs directly above the Design Area. 5. Palette:
Palette contains controls or components used to create GUI applications.

2. D/f b/w
a. Parent controls and Child controls.
Parent Controls: They act as a background for other controls. For
example-Frame. When we delete a parent control, all its child controls
get deleted. When we move a parent control all its child controls also
move along with it. the class whose properties are inherited is known as
parent class (base class, superclass class).

Child Controls: controls placed inside a container control are called child
controls. For example-Text Field, Label, Button etc. The class which
inherits the properties of other is known as child class (derived class, sub
class)

b. TextField & Text Area


The main difference between JTextField and JTextArea in Java is that
a JTextField allows entering a single line of text in a GUI application while
the JTextArea allows entering multiple lines of text in a GUI application.

c. List & Combo box


List Box :
1. Occupies more space but shows more than one value.
2. We have both drop up & drop down facility.
3. We have only drop down facility.
Combo Box:
1. Occupies less space but shows only one value for visibility
2. Multiple select is not possible
3. We have only drop down facility.
d. Radio Button & Check Boxes
Checkbox:
A checkbox is an input option that represents a setting or value with an
on, off, or mixed-choice. A check mark within the checkbox indicates that
the setting is selected or checked.
Checkboxes in a group are non-exclusive options; more than one
checkbox in a group can be checked at any given time. JCheckBox is a
group of checkboxes in which multiple items can be selected at a time.

Radio Buttons:
A radio button is one of a group of controls representing mutually-
exclusive choices. A radio button is typically represented as a round
control to distinguish from the square checkbox control. JRadioButton is
a group of buttons in which only one button can be selected at a time .

e. setText() & getText()


getText() :-
This method is used to retrieve (or receive) the text of a component like
Text Feild at run time
e.g : name.getText();
setText:-
This method is used to change the display text of a component like
label, text field or button at run time
e.g nn.setText(""+name);

f. = & ==
= is an Assignment Operator it is used to assign the value of variable or
expression, while ==is an Equal to Operator and it is a relation operator
used for comparison (to compare value of both left and right side
operands).

g. / & %
Both are arithmetic operators. ‘%’ -> Modulus operator that returns the
remainder in division
whereas ‘/’ -> Divide operator that return quotient.

h. Pre Increment & Post Increment


Pre-increment means that the variable is incremented BEFORE it's
evaluated in the expression. Eg ++i;
Post-increment means that the variable is incremented AFTER it has
been evaluated for use in the expression. Eg i++;
i. Iteration Statement & Selection Statement
Selection statements test conditions and selectively execute code
depending on the outcome of the test condition,
whereas repetition statements repeat a set of statements till a test
condition is satisfied.

j. parseInt() & parseDouble()


The parseInt() function converts a string into an integer.
The parseDouble() converts a string to Double datatype.

k. Line Wrap & Word Style Wrap.


lineWrap: Indicates whether line of text should wrap in case it exceeds
allocated width.(Default is false)
wrapStyleWord: Sends word to next line in case lineWrap is true and it
results in breaking of a word, when lines are wrapped.

3. Name 2-2 properties of jFrame, jPanel, jTextField, jText Area,


jList, jComboBox, jButton.
jFrame
defaultCloseOperation: Sets action to be performed when the user
attempts to close the form.
Title : Sets the text to be displayed in the Title bar of the form window.
jPanel
add(Component c) : adds component to a specified container.
setLayout(LayoutManager l) : sets the layout of the container to specified
layout manager.
updateUI() : resets the UI property with a value from the current look and
feel.
jTextField
editable: If set true user can edit textfield. Default is true.
Enabled: Contains enabled state of component- True if enabled else
false.
font :Sets the font.
jText Area
rows: Sets number of rows preferred for display. text :Sets the display
text
wrapStyleWord: Sends word to next line in case lineWrap is true and it
results in breaking of a word, when lines are wrapped.
jList
background: Sets the background color.
Enabled: Contains enabled state of component- true if enabled else
false.
Font: Sets the font.
Foreground: Sets the foreground color.
Model: Contains the values to be displayed in the list.
jComboBox
editable: If set true user can edit ComboBox. Default is true.
Enabled: Contains enabled state of component- True if enabled else
false.
font : Sets the font.
jButton
horizontal alignment: Sets the horizontal alignment of text displayed on
the button.
Label: Sets the display text.
Text: Sets the display text

4. What do you mean by a Variable? Write its 4 characteristics.


A variable is a name which is associated with a value that can be
changed. For example when I write int i=10; here variable name is i
which is associated with value 10, int is a data type that represents that
this variable can hold integer values.
 It has a name.
 It is capable of storing values.
 It provides temporary storage.
 It is capable of changing its value during program execution.

5. Explain d/f selection modes in List.


The mode for selecting values. –
SINGLE (List box allows single selection only)
SINGLE_INTERVAL (List box allows single continuous selection of
options using shift key of keyboard)
MULTIPLE_INTERVAL (List box allows multiple selections of options
using ctrl key of keyboard)

You might also like