wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Creating a circle shape java swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Creating a circle shape java swing" Watch "Creating a circle shape java swing" New topic
Author

Creating a circle shape java swing

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi,

I am having an idea of creating a circle shaped JAVA swing application. I am not asking about drawing shapes inside a NORMAL java application, I just want to make my whole application a circle. How to do this? I have no idea. Please help.


Are you better than me? Then please show me my mistakes..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Java 7 finally has support for this; you can use setOpacity to change the window transparency, and setShape to change the shape of windows. Note that there are rules for calling these methods; check out the Javadoc page of java.awt.Window for more information.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

GREAT!!! Thanks a lot for the help.. Will check this out tomorrow (it is 12.36 AM here) and come up with a code for more help. Thanks a lot
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

You're welcome.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Well, I found the oracle tutorial for this purpose. Anyway it is very hard to understand. Whatever I do simply throws "Window is Decorated" exception. Hope to open a new thread based on that issue. Thanks again for helping me, Rob Spoor..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Just call setUndecorated(true) on your window before you change the shape. This will hide the title bar etc.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Excellent!! I wanted to set the opacity, and now it is working fine!! Thanks a lot for the help!! Now time to move to the Shapes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a circle shape java swing
 
Similar Threads
Creating your own class
Run JAR file in Applet
Effect on Swing Application java 1.3 to 1.4
increasing the effect of the filled circles
Configuring org.apache.commons.pool.impl.GenericObjectPool