Irregular window in Java ?

I wonder if there was a way to create an irrgular window in Java… by “irregular” I mean that it can be, for example, a triangle window, or a circular window, or even a window with transparent hole in it!

Does anyone knows how to do that in Java ? or is there any lib (native or not) available on the web to do that ?

Thanks
Chman

I recall l2fprod having a native (windows) DLL for doing irregular windows. haven’t checked recently, but it might still be available (www.l2fprod.com)

Not something I’ve tried, but I believe it should work:

If you use a “Window” not a “Frame” you do away with all the titlebars, window frame etc. Then you can use a pixel-grabber to snapshot the screen contents behind your window, and paint them over the top to make your window effectively transparent. Then you’re free to draw whatever shape windows you want!

PROS: Works pretty much everywhere without need for external libraries.

CONS: A lot more work, and you have to draw all the window decorations you want manually.

Thx for your replies…
I think cfmdobbie’s solution is a good one (no need for external libs) but is not the easier to do… and not the faster !

cfmdobbie’s solution does not cover event handling! I don’t know how to ignore mouseclicks to the non-opaque parts of the window or to delegate them to the desktop/parent.

ah yeah it’s true, i haven’t thought about that… o l2fprod would be a great solution but it’s windows specific so…

Good point - I hadn’t considered event handling. ;D :stuck_out_tongue:

Hrm, with the requirement to properly handle window events as well, I’m afraid you’re high and dry. There’s no way I know to do that in a platform-independant way. You will probably have to drop back to JNI, get a handle to the window and manipulate it directly with native windowing commands. Ouch.

Ouch ! :slight_smile:
I will finally keep my classical Java JFrame…

there was a thread on the old board about that. there was even some code using Robot’s screencapture.
The thread ended with “it’s a 1.5 feature”, as far as i recall… :slight_smile:

Heh… got it…
http://www.java-gaming.org/discus/messages/2/1315.html

chman… chman… ca me rappelles une anim sous flash avec un gars ‘chevelu’ sur une plage ou pas loin… un rapport?

Ca fait plaisir de voir des francais sur cette board !
non en fait ca n’a aucun rapport avec la team cHMan… tu faisait référence à Banja, un jeu en flash de la team en question…
mon pseudo vient de nul part… et j’ai l’habitude de l’écrire Ch*man pour éviter la confusion avec cHMan…

argh! why do people post in languages other than english? english the the most common language here as this is a forum and the whole purpose is to let people communicate. i’m sure everyone would understand me typing swedish!

bad english is also ok! (i know you french people don’t like it very much)

Don’t worry, the messages aren’t intended to be read by anyone else! ;D Pepe and Ch*man normally do write in English.

I’m afraid I’d be lost if you started writing Swedish, although it would add to the atmosphere. I’m afraid all the Swedish I know is something about a chocolate moose…? :wink: :smiley: ;D ::slight_smile:

it’s not so bad on this forum, not yet anyway. at cgtalk for instance it’s a common thing and it’s pretty pointless.

anyway, i have no idea what chocolate moose you’re talking about lol :slight_smile:

sorry for drifting away from topic…

Hem, sorry, guys. The little french sentence was to ask about the origin of ch*man’s nick. There are times you feel quite alone as a French citizen, actually more than ever. :’( Some ‘native’ words help sometimes. Well… Enough drama, will not do that again, i swear. (moreover, i wasn’t sure to explain myself correctly in english… that was a lazy solution as well. )

Back on topic. After re reading the bug report i posted here, and the answer from sun, i’m not sure that the RFE is to be implemented. Isn’t there an AWT team member reading us?

you’re not alone, we are all with you! :slight_smile:

having a transparent window could post some pretty weird things…

like u could make your program launch an entire window, that is totally transparent, and have no way out…

hehe… that’d be pretty funny…

why do u want a transparent window anyway??

It’s less having transparent windows than shaped windows. Rounded corners to your windows, a round (analogue) clock, see-through areas etc.

thatd be annoying to have se thru parts of a window…

wouldnt it?

Um. Not if that’s what you wanted to have? ::slight_smile: