• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating a circle shape java swing

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just call setUndecorated(true) on your window before you change the shape. This will hide the title bar etc.
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic