How to write Mouse Motion Listener

When the mouse is moved a pixel(single) in any direction(X,Y(Width,Height)), a mouse move event is generated.There are two mouse movement events :mouseMoved ,mouseDragged .mouseDragged() works where the movement occurs with the mouse button pressed down and mouseMoved() works where the mouse button isn't pressed.

How to Add ActionListener in JButton in Swing

The ActionListener interface declares a method that is called when an action event is generated. Only single method is defined in ActionListener interface and that is void actionPerformed(ActionEvent ax).

How to use JTabbedPane in Swing

JTabbedPane in swing enables you to group several swing component groups on the same container. To view a particular component group, you need to select the tab corresponding to the component group in the tabbed pane. A JTabbed Pane component provides quick access to the multiple JPanels using the same space and Window.

Program to implement interfaces

Interface is the prototype of class (means we can declare the functions only)that can be implemented by any number of classes. It is the collection of methods and variables. Methods are only abstract methods means the methods has no statements. We use interface keyword to declare an interface.

Passing parameters to Applet in Java

An <applet> tag is used to pass parameter in an applet. We use <PARAM> tag to pass anapplet parameters. The <PARAM> tag has two attributes one is NAME and other is VALUE.

Program to access the Vector class in Java

Vectors are another form of Arrays in Java. The difference between array and vector is that Vector is a generic dynamic array that can hold any number of objects. The vector class is defined in the special package and that is java.util package.

Variable size Array in Java

In java we can create arrays that are not rectangular. Such type of arrays are called unstructured arrays or N-dimensional array. To declare such type of arrays, you can specify memory to store separate number of elements in separate rows.

BorderLayout in Applet

BorderLayout divides the container into five parts (directions),east,west,north,south,centre. By using this Layout we can place AWT components in each parts(different location).

GridLayout in Applet

GridLayout places components(Labels,TextFields etc) in a grid of equally sized cells(intersection of a row and a column), adding them to the grid from left to right and top to bottom.It divides the containers into rows and columns.

Program to perform functions of a calculator

The Switch-case statement is a multi way decision statement. If and if-else are used for small number of choices but when we have large number of conditions we use switch-case statement. Depending upon the value supplied by user, the appropriate case is matched, the corresponding statements will be executed, all the other cases will be skipped.

Page 23 of 30