You are not logged in.

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

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...

  • Send private message

1

Tuesday, March 29th 2011, 8:19pm

Hide Cursor

Well I'm making a simple app to prank my dad on april fools day, where he goes on his comp, and it don't work. It's called BlackScreen (pretty self explanatory)

Well I tried System.Windows.Forms.Cursor.Hide() and it didn't work, can anyone help???
Be the change you WANT to see in the world!

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Tuesday, March 29th 2011, 9:21pm

Well, I'm a dad myself.
And I would be quite annoyed to receive such jokes.

Please try to come up with something more enjoyable.

Cheers

A1880

b.t.w.: "System.Windows.Forms.Cursor.Hide" belongs to the .Net Framework and is thus not available as such in a Java environment.

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

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...

  • Send private message

3

Thursday, March 31st 2011, 8:42pm

It's a yearly thing, I do a harmless prank to his comp so hey'll be expecting it.
Be the change you WANT to see in the world!

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

4

Friday, April 1st 2011, 6:59pm

Read this one:
http://stackoverflow.com/questions/19159…-exclusive-mode
There is an example code.

When you port it to Jabaco, it looks like

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

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

5

Monday, April 4th 2011, 12:28pm

The nice thing of your wanted program is, that it is so easy and small.
So I have written it in Java, if it will help you:

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);
  }

}

mikethedj4

Beginner

  • "mikethedj4" is male
  • "mikethedj4" started this thread

Posts: 12

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...

  • Send private message

6

Wednesday, April 13th 2011, 6:49pm

Thanks for the help bro.

BlackScreen's Java app is now on Sourceforge. (It's open source btw)
Be the change you WANT to see in the world!

Rate this thread
WoltLab Burning Board