Java – SystemTray example
This is small example that explain use of SystemTray in java. What is System Tray : It is an area where small icon of running application will display and show popup messages. Where is it in windows ? Below is a image of SystemTray in windows. Here is a example of how to implement SystemTray [...]
Java – Control the mouse pointer and click
Here is a small java programs that is use to control your mouse. Move your mouse cursor position on screen. Mouse left click Mouse middle click Mouse Right Click Mouse Double Click
Java – Read Mouse Position
This is small program that read mouse X and Y position using Java. This program read mouse position even if it is not within your application means it is not using any mouseMove event. Point p = MouseInfo.getPointerInfo().getLocation(); System.out.println(” X: ” + p.x + ” Y: ” + p.y);
Java – ThreadLocal
Thread Local can be considered as a scope of access, like a request scope or session scope. It’s a thread scope. You can set any object in Thread Local and this object will be global and local to the specific thread which is accessing this object. Global and local!!? Let me explain: Values stored in [...]
Java – Reading and Writing objects to a file
This tutorial will explain how to persist object and read again in java. Here we store object in .txt file and read form txt file. Here ObjectOutputStream is use to persist object in txt file and ObjectInputStream to read object from text file. Create project structure as shown in below image. Create two packages 1. [...]
Java – Synthetic
Synthetic in java This is small demo code that help you to understand synthetic. Some time compiler generate some code at runtime that is not in source code that must be marked as synthetic, except for default constructors and the class initialization method. Compiler can generate class,methods and variables. When synthetic generated ? – Generics, [...]
Java – Read Emails From VCF
This is small java program that read emails form VCF file. vcf is use to store mobile contacts information. Like PhoneNo,Email,Name and Photo. Here i created small java program that read all emails from vcf file. Here I am using mailapi.jar file, You can get it from : http://www.oracle.com/technetwork/java/javamail/index.html Find below code that read email [...]
HTML 5 Database
This is a tutorial about HTML5 database. Here i explain how to create database,insert,update and select from database in html5. Now a days most of browser support html5. Here we use JavaScript functions for database operation. Here some javascript functions that used for database operation : 1. openDatabase : This function return database object. 2. [...]
User defined exception in java
This tutorial will explain about custom exception. You can write your own custom exception in java. To create custom exception we need to extends Exception class. Create project structure as shown in below image. Create new project MyException as tow packages 1. com.omt.main 2. com.omt.myexception Create NegativeValueException.java class in com.omt.myexception package. It is our custom [...]
Enum in Java
This is simple enum tutorial. What is Enumeration (Enum) ? In java enum is a keyword. It is introduced in JDK 1.5. It is like class and interface in java and All enums implicitly extend java.lang.Enum. It is use to define constants. Generally we define constants as shown below : But above constant is not [...]