Menu Bar Program Calculator Program Form Program Applet Program Interface Program Inner Class Program Difference Between Swing and AWT?
Menu Bar Program Calculator Program Form Program Applet Program Interface Program Inner Class Program Difference Between Swing and AWT?
Calculator Program
Form Program
Applet Program
Interface Program
Inner Class Program
TextField TextArea
TextField is an AWT component TextArea is an AWT component
that allows entering a single line of that allows entering multiple lines of
text in a GUI application text in a GUI application.
It doesn’t have a scrollbar. It does have a scrollbar.
What is the method used to place some text in the text field?
void setText(String str) is the method used to place some text in the text
field
.
Explain Component and Container.
The component is an abstract class that encapsulates all of the
attributes of a visual component. Except for menus, all user interface
elements that are displayed on the screen and that interact with the user
are subclasses of Component. It defines over a hundred public methods
that are responsible for managing events, such as mouse and keyboard
input, positioning and sizing the window, and repainting.
List out methods defined inside KeyListener interface with their method
signature?
Methods defined inside Key Listener interface with their method signature
are
keyPressed( ): Methods are invoked when a key is pressed
keyReleased( ): Methods are invoked when a key is released, respectively.
keyTyped( ): Method is invoked when a character has been entered.
An inner class is a class which is defined inside another class. The inner
class can access all the members of an outer class, but vice-versa is not
true.
What is MVC?
MVC framework is software architecture used to separate the data access
layer, business logic code and the graphical user interface that has to be
defined and designed to let the user interact with the application. This
application has three parts,
MODEL
VIEW
CONTROLLER
import java.applet.Applet;
import java.awt.Graphics;
/*
<applet code="UseParam.class" width="300" height="300">
<param name="msg" value="Welcome to applet">
</applet>
*/
public class UseParam extends Applet {
public void paint(Graphics g) {
String str = getParameter("msg");
g.drawString(str, 50, 50);
}
}
RequestDispatcher in java?
The RequestDispatcher interface provides the facility of dispatching the request to another
resource it may be html, servlet or jsp. This interface can also be used to include the
content of another resource also. It is one of the way of servlet collaboration.
1. RequestDispatcher rd=request.getRequestDispatcher("servlet2");
rd.forward(request, response);//method may be include or forward
ErrorPage attribute?
In JSP, the errorPage attribute of page directive is used to specify a web page which will
be displayed as an error page for the current JSP page i.e. if there is an error while
executing the current page).
Syntax
Connection Pooling?
3) public boolean execute(String sql): is used to execute queries that may return
multiple results.