How to filter specific type of Files using FileFilter class in java?

Below java code show how to filter specific type of files using FileFilter class – To implement the FileFilter interface we need to create an accept() method which takes a java.io.File object as parameter. In the method we check wheter the name ends with “.txt” and if so we return true, else false. When we …

Read More

How to change an applet background color?

Applet’s default background color is Grey. If you want to change it then you need to call the setBackground(java.awt.Color) and choose the color you want. Defining the background color in the init method will change the color as soon as the applet initialized.

Read More

How to Write/Store an object to file in java?

Writing a Java objects to a file is called as Serialization in java. In order to do this, you have to implement the Serializable interface, and use ObjectOutputStream to write the object into a file. To do this we have created Employee class which implements java.io.Serializable. To write an object to a stream call the …

Read More