AJP Qans Experiment One
AJP Qans Experiment One
Experiment no One
Title:- Write a program to design a form using the component textfield , label, checkbox, button,
list.
Answer:- A Choice is displayed in a compact form that requires you to pull it down to see the list of
available choices. Only one item may be selected from a Choice. A List may be displayed in such a
way that several List items are visible
Answer:-
Modeless type — A modeless dialog box does not block any other window while it is visible.
Document-Modal type — A document-modal dialog box blocks all windows from the same
document, except windows from its child hierarchy.
4] In which layout we can arrange the components in row and column format.
Conclusion:-
Questions:-
Containers
Containers hold and organize your Components, but they also contain code for event handling and
many 'niceties' such as controlling the cursor image and the application's icon.
Containers:
Frame
Window
Dialog
Panel
Component
Components are generally the stuff that the user interacts with. The meat and potatoes of your
application. (as discussed in the Introduction).
List of common Components
List
Scrollbar
TextArea
TextField
Answer:-
Answer:-
1. Import java.awt
import java.awt.*;
2. Extending frame or applet
Frame f=new Frame();
3. Set the layout.
f.setlayout(new FlowLayout());
4. Create components
Label l1=new Label(“Name”);
5. Adding the components to the frame or applet
f.add(l1);
Answer:- In check box you can have multiple choice but in case of checkboxgroup button you have
select any one at a time.
Answer:- Frame : A resizable, movable window with title bar and close button. Usually it contains
Panels. It is Derived From Window. Default layout is BorderLayout.
Panel : A region internal to a Frame or another Panel. Used for grouping components together. Not
bounded by a visible border. You can change background colour of a panel to delimit it though. Lives
inside some enclosing Container.It is Derived From Container. Default layout is FlowLayout.
Answeer:-
1. Import java.awt
import java.awt.*;
2. Extending frame or applet
Frame f=new Frame();
3. Set the layout.
f.setlayout(new FlowLayout());
4. Create components
Label l1=new Label(“Name”);
5. Adding the components to the frame or applet
f.add(l1);
Answer:- Controls are components that allow a user to interact with your application.
- A component is a graphical object.
Button
Canvas
Checkbox
Choice
Container
Label
List
Scrollbar
TextComponent
TextField displays only one line of text of any length. TextArea displays multiple lines of text
of any length.
TextField generates ActionEvent handled by ActionListener and TextArea generates
TextEvent handled by TextListener.
Class constructors
S.N. Constructor & Description
Button()
1
Constructs a button with an empty string for its label.
Button(String text)
2
Constructs a new button with specified label.
Answer:- The Button class is used to create a labelled button. The application result in some action
when the button is pushed.
Answer:- The Scrollbar class embodies a scroll bar, a familiar user-interface object. A scroll bar
provides a convenient means for allowing a user to select from a range of values alternatively, a
scroll bar can represent a range of values. For example, if a scroll bar is used for scrolling through
text, the width of the "bubble" (also called the "thumb" or "scroll box") can be used to represent the
amount of text that is visible
Answer:-
Class constructors
S.N. Constructor & Description
Label()
1
Constructs an empty label.
Label(String text)
2
Constructs a new label with the specified string of text, left justified.
Label(String text, int alignment)
3
Constructs a new label that presents the specified string of text with the specified alignment.
Answer:- The CheckboxGroup class is used to group together a set of Checkbox buttons.
Exactly one check box button in a CheckboxGroup can be in the "on" state at any given time.
Pushing any button sets its state to "on" and forces any other button that is in the "on" state
into the "off" state.