How to create Vertical Progressbar in java swing?

Many times we need to create progress bar with veritcal orientation, its easy to create vertical JProgressBar. JProgressBar have constructor JProgressBar(int orient) which creates a progress bar with the specified orientation, which can be either [...]

Factory Pattern

Factory Pattern: Intro : Lets see what Factory means in terms of software engineering : Factory : A factory is an object which works for creating other objects according to various allocation schemes. A factory object has a method for every [...]

How to center JFrame on screen?

We many times need to center the JFrame on screen , to center the JFrame on screen we can use setLocationRelativeTo method by passing null as owner. Following is the code to set the JFrame at center position , first we are creating the JFrame [...]

How to check if your code is running on the Java Event Dispatch Thread

How to check if your code is running on the Java Event Dispatch Thread Many times we need to check whether code is running on the Java Event Dispatch thread or not ? We can use static method of the SwingUtilities class if we are not sure if [...]

Singleton Design Pattern

Singleton Design Pattern Intro : Meaning of Singleton : n. a single object individual etc separated or distinguished from a pair n. (Mathematics) Maths a set containing only one member. Singleton design pattern deals with restricting instantiation [...]

How to copy one directory to another directory in java?

Below is the code snippet of method to copy one directory to another directory. The method accepts two arguments one is source directory and another is target directory. This method copies the subdirectories and subfiles recursively as shown [...]

How to read contents of File in Java?

We can read the contents of a file using two techniques, first is reading contents using DataInputStream and another is BufferedReader. Reading contents using DataInputStream: DataInputStream makes easier to read integer, float, double data [...]

How to write into a File in Java?

We can write contents into a file using two methods , using BufferedWriter and FileOutputStream , lets see how we can write the contents using these methods : Writing a file using BufferedWriter : BufferedWriter write text to a character-output [...]

How to change the size of scrollbar in JComboBox?

Sometimes we need to change the size of vertical scrollbar then we can use PopupMenuEvent. We can get popup object from the JComboBox and then we can get JScrollPane component. From JScrollPane component we need to get JScrollBar , using this [...]

What is autoboxing and unboxing in java 5?

Before J2Se 5.0 all the primitive values like int, long , double etc are needed to convert them into the objects using wrapper classes. Suppose we want to use object or we want to put primitive values into the collection it was hard as we needed [...]
Page 11 of 15« First...910111213...Last »