How to use GridBag Layout in Java

The layout manager class provides a means for controlling the physical layout of GUI(Graphical User Inteface) elements.The GridLayout places components in rows and columns and are of equal sizes But GridLayout is used to places the components not be of the same size and places in any row or columns.

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.

Page 23 of 30