Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 3232 times)
0 Members and 1 Guest are viewing this topic.
Offline Pyrodragoon

Junior Devvie

Exp: 14 years

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

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

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

Exp: 14 years

« 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 »


does it help ?

Offline Orangy Tang

JGO Kernel

Medals: 57
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.

[ - 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: 120
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
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:

Pages: [1]
  ignore  |  Print  

EgonOlsen (44 views)
2018-06-10 19:43:48

EgonOlsen (24 views)
2018-06-10 19:43:44

EgonOlsen (46 views)
2018-06-10 19:43:20

DesertCoockie (201 views)
2018-05-13 18:23:11

nelsongames (126 views)
2018-04-24 18:15:36

nelsongames (125 views)
2018-04-24 18:14:32

ivj94 (866 views)
2018-03-24 14:47:39

ivj94 (127 views)
2018-03-24 14:46:31

ivj94 (770 views)
2018-03-24 14:43:53

Solater (142 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!