adsense


Showing posts with label JAVA EXAMPLES CREATE A TRANSPARENT CURSOR. Show all posts
Showing posts with label JAVA EXAMPLES CREATE A TRANSPARENT CURSOR. Show all posts

Monday, 2 November 2015

JAVA EXAMPLES CREATE A TRANSPARENT CURSOR PAGE 227

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES CREATE A TRANSPARENT CURSOR










Java Examples - Create a transparent cursor



Problem Description:
How to create a transparent cursor?
Solution:
Following example demonstrates how to create a 
transparent cursor by using createCustomCursor() 
method with "invisiblecursor" as an argument.
import java.awt.*;
import java.awt.image.MemoryImageSource;

public class Main {
   public static void main(String[] argv) throws Exception {
      int[] pixels = new int[16 * 16];
      Image image = Toolkit.getDefaultToolkit().createImage(
      new MemoryImageSource(16, 16, pixels, 0, 16));
      Cursor transparentCursor = Toolkit.getDefaultToolkit().
      createCustomCursor(image, new Point(0, 0), 
      "invisibleCursor");
      System.out.println("Transparent Cursor created.");
   }
}
Result:
The above code sample will produce the following result.
Transparent Cursor created.


JAVA EXAMPLES CREATE A TRANSPARENT CURSOR PAGE 216

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES CREATE A TRANSPARENT CURSOR







Java Examples - Create a transparent cursor

Problem Description:
How to create a transparent cursor?
Solution:
Following example demonstrates how to create a transparent cursor by using createCustomCursor() method with "invisiblecursor" as an argument.
import java.awt.*;
import java.awt.image.MemoryImageSource;

public class Main {
   public static void main(String[] argv) throws Exception {
      int[] pixels = new int[16 * 16];
      Image image = Toolkit.getDefaultToolkit().createImage(
      new MemoryImageSource(16, 16, pixels, 0, 16));
      Cursor transparentCursor = Toolkit.getDefaultToolkit().
      createCustomCursor(image, new Point(0, 0), 
      "invisibleCursor");
      System.out.println("Transparent Cursor created.");
   }
}
Result:
The above code sample will produce the following result.
Transparent Cursor created.