Beginner
Date of registration: Mar 24th 2010
Location: Rockford, IL
Occupation: Freelancer, Inventor
Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Beginner
Date of registration: Mar 24th 2010
Location: Rockford, IL
Occupation: Freelancer, Inventor
Hobbies: Programming, Design, Engineering, Dancing, and anything else I find to be fun...
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
Import java#awt#Toolkit Import java#awt#Graphics2D Public Sub Form_Load() Dim myToolkit As Toolkit myToolkit = Toolkit.getDefaultToolkit ' get the smallest valid cursor size Dim myDim As Dimension myDim = myToolkit.getBestCursorSize(1, 1) ' create a new image of that size with an alpha channel Dim cursorImg As BufferedImage cursorImg = New BufferedImage (myDim.width,myDim.height, BufferedImage.TYPE_INT_ARGB) ' get a Graphics2D object to draw to the image Dim g2d As Graphics2D g2d = cursorImg.createGraphics() ' set the background 'color' with 0 alpha and clear the image g2d.setBackground(New Color(0.0, 0.0, 0.0, 0.0)) g2d.clearRect(0,0,myDim.width,myDim.height) ' dispose the Graphics2D object g2d.dispose() ' now create your cursor using that transparent image Dim hiddenCursor As Cursor hiddenCursor = myToolkit.createCustomCursor(cursorImg, New Point(0,0), "hiddenCursor") ' use the hidden Cursor Parent.setCursor( hiddenCursor ) End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import javax.swing.*; import java.awt.*; import java.awt.image.*; public class BlackScreen extends JFrame { public BlackScreen() { Toolkit toolkit = Toolkit.getDefaultToolkit(); // get the smallest valid cursor size Dimension dim = toolkit.getBestCursorSize(1, 1); // create a new image of that size with an alpha channel BufferedImage cursorImg = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB); // get a Graphics2D object to draw to the image Graphics2D g2d = cursorImg.createGraphics(); // set the background 'color' with 0 alpha and clear the image g2d.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.0f)); g2d.clearRect(0, 0, dim.width, dim.height); // dispose the Graphics2D object g2d.dispose(); // now create your cursor using that transparent image Cursor hiddenCursor = toolkit.createCustomCursor(cursorImg, new Point(0,0), "hiddenCursor"); // use the hidden Cursor this.setCursor( hiddenCursor ); // sets background color to back this.setBackground(Color.black); // shows only the part in the window, not the frame around it this.setUndecorated(true); // sets the size to full screen GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this); } public void paint(Graphics g){} public static void main(String[] args) { BlackScreen window = new BlackScreen(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); } } |