Hi,
I have been trying to get a java program that draws a line directly on the screen. I have made ones that draw on JApplets and JFrame's but i cant work out how i can draw directly on the screen without having something in the way.

I looked at using Java canvasses but couldn't see a way i would do it with those so im a bit flummoxed. :S

Is there a way to do this in java? :)

Recommended Answers

All 4 Replies

If it can be done using the Win32 C++ API (On Windows), then you might be able to accomplish this using JNI (Java Native Interface), but all of the documentation is very old. I believe you can "fake" it by making the JFrame Translucent, and just drawing on it when it's like that. Here's some info about making frames translucent. Translucent Frames

Hope this helps =)

yeah, the only problem with having transparent frames is that i would like the user to be able to click the things on the other side of the frame, so that it is not "taking up" the focus.

If that makes sense :P

hmm, I don't know if making the frame un-focusable after making it transparent would allow you to click through it or not....
I'm sorry I couldn't be more help, maybe someone else knows.

No worries, thanks for trying. If anyone has any other ideas i would love to know. I know you can do this in python, i thought java would have the same functionality. :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.