Timer and TimerTask in Java Swing

We use java.util.Timer for threads.This class provides schedule tasks for future execution in a background thread. We use java.util.TimerTask to set scheduled for one-time or repeated execution by a Timer.

How to Validate TextField in Java Swing

We can define a validation to validate user input for textfields, password fields etc.If the user entered value does not match the validation pattern, a message appears.

Java Swing Calculator

By using a calculator we can calculate arithmetic operations(mathmetical computations) on numbers .Arithmetic operations means addition, subtraction,multiplication, divison etc.

Chess Board in Java Applet

Each square(rectangle) in the chessboard is 20 pixels by 20 pixels.The squares are grey and black.If the row and column are either even or odd, then the color is Grey.Otherwise, change color into Black.

How to draw Rectangle in Java Applet

Rectangle can be drawn by using drawLine() method. With this method, only the outline of the rectangle is drawn using Graphics object(Graphics gra)color but of the rectangle is not filled with this color. To draw a filled rectangle, the graphics class provide the fillRect() method.

The Finally block in Java

Finally blocks are executed once the try block exits. This block executes even after the unexpected exceptions has occurred. Irrespective of the try block, the expression in finally block is always executed. This block is in-built with the capability of recovering loss and preventing leak of resources. On closing and recovery of a file, the expression should be placed in the finally block.

Multi-Level Inheritance in Java

Multi-level inheritance was introduced to enhance the concept of inheritance. When a subclass is derived from another subclass or derived class, it is known as the multi-level inheritance. In multilevel inheritance, the subclass is the child class for its super class is the subclass for another super class. Multi-level inheritance can go up to any number of levels.

Passing a two-dimensional array as an argument in C

Array can also be passed to the function. To pass an array, you need to specify the name of the array and the size of the array in actual arguments. The corresponding formal arguments will also have array with two subscripts, size of first subscript can be omitted, a variable to hold the row size and a variable to hold the column size. The three arguments in the actual arguments list.

Program to find sum of positive numbers and exit when negative number is entered in C

In this example we use arrays(one dimensional array). Arrays are declared in the same as simple variables, but the difference is that each array name must be accompanied by a size(aa[20]) specification using subscript.

How to write a Tree Selection Listener in Java

A tree component is paired with some other component. When we selects tree nodes, some information shows up in another window.

Page 10 of 30