Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Frameshape on Desktop  (Read 1877 times)
0 Members and 1 Guest are viewing this topic.
Offline Pyrodragoon

Junior Devvie




Art calculated with java...


« Posted 2008-07-25 10:24:02 »

Hi
I want to create a little Desktop-Game
and what I need is to know how
to give a Frame or JFrame, whatever,
a certain shape.
Normally a Frame has a rectangular shape
and with
1  
Frame.setUndecorated() 

is achieved that only the frame itself is visible.
But what I need now is a frame that only shows an ellipse f.e. on the desktop.
If so, how is this possible?
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #1 - Posted 2008-07-25 10:33:44 »

Not possible with Java.  You might be able to do this using JNI, but that is pretty advanced.

Offline zammbi

JGO Coder


Medals: 4



« Reply #2 - Posted 2008-07-25 10:48:24 »

I'm sure I read somewhere on how to do this. Searching google didn't help?

Current project - Rename and Sort
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Pyrodragoon

Junior Devvie




Art calculated with java...


« Reply #3 - Posted 2008-07-25 10:51:41 »

Thanks for the fast answer  Smiley
So I'll have to put a little rectangular Frame around
the shapes I want to see on my desktop.
Java´s not so mighty at all  Undecided

@ zammbi
Maybe what you saw was also JNI like CaptainJester mentioned...

The only solution I found was
to make a screenshot from the desktop
and use parts of it to simulate something like transparency
so that you only see the parts you want from the frame.
Offline DzzD
« Reply #4 - Posted 2008-07-25 11:07:38 »


http://rabbit-hole.blogspot.com/2007/02/non-rectangular-windows.html

EDIT:
 
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/

does it help ?

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #5 - Posted 2008-07-25 12:12:09 »

You can do this with SWT, so if the feature is really important to you you could switch to that.

Alternatively you can embed AWT controls in SWT controls now, so you might be able to use that as well.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline jezek2
« Reply #6 - Posted 2008-07-25 13:09:54 »

You can use JNA to do this, which is library for accessing native libraries from Java without need to use JNI. It has example that does exactly that for all three major platforms (win/mac/lin).
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 81
Projects: 15


★★★★★


« Reply #7 - Posted 2008-07-25 13:53:48 »

its also possible to fake transparency on a frame to achieve this effect. This is done using the Robot class to take a screenshot and place it as the background of the frame, the screenshot is refreshed at set intervals.
Offline Wildern

Junior Devvie





« Reply #8 - Posted 2008-07-25 14:18:38 »

I think this chapter of Killer Game Programming in Java may have what you are looking for
https://fivedots.coe.psu.ac.th/~ad/jg/ch045/index.html
Offline bjgil2

Senior Newbie




That's it Mr. Giraffe, get all the marmalade


« Reply #9 - Posted 2008-07-25 15:03:35 »

This should do the trick:

http://www.pushing-pixels.org/?p=260

Cheers,
Brett
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (36 views)
2014-12-15 09:26:44

Mr.CodeIt (29 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (98 views)
2014-12-08 04:46:31

JscottyBieshaar (58 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (76 views)
2014-11-29 21:32:03

toopeicgaming1999 (137 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (37 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!