Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (622)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (674)
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 2125 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 »

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

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 »


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: 96
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  
You cannot reply to this message, because it is very, very old.

basil_ (32 views)
2015-09-30 17:04:40

shadowstryker (16 views)
2015-09-29 15:55:06

TheSpaceHedgehog (22 views)
2015-09-29 01:58:48

GamerC4 (45 views)
2015-09-24 21:10:38

GamerC4 (66 views)
2015-09-24 21:09:48

htuy (21 views)
2015-09-24 04:57:24

htuy (30 views)
2015-09-24 04:56:35

htuy (20 views)
2015-09-24 04:56:09

htuy (21 views)
2015-09-24 04:47:33

Roquen (58 views)
2015-09-21 12:54:28
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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!