Solved

Circular JFrame

Posted on 2010-11-13
8
504 Views
Last Modified: 2012-05-10
Overwhelmed with the help so far...
thanks a lot all .

I am trying to get a JFrame in the shape of a circle ..

I will be really grateful if someone can give some code snippet ..

thanks again !
0
Comment
Question by:hipal
  • 3
  • 3
  • 2
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 34128109
Not possible i'm afraid. JFrame is a top level window and they are never round
0
 

Author Comment

by:hipal
ID: 34128129
how about JPanel ?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 34128333
You'd need native code to 'fake' roundness with transparency. Try this

http://jna.dev.java.net/demo/ShapedWindowDemo.jnlp
0
 
LVL 92

Expert Comment

by:objects
ID: 34128990
All components are rectangular by definition, and top level windows are tied to the native window system which is also rectangular.

you can give a component the illusion of not being rectangular by leaving the background transparent.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:hipal
ID: 34129598
thanks all ..

can I do similar things for JButton ?
0
 

Author Comment

by:hipal
ID: 34129601
@CHEJ .. I am not able to find the code for the link you send :(
0
 
LVL 92

Expert Comment

by:objects
ID: 34129640
How does that help you exactly?
(and you don't need to write any native code)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34130564
>>@CHEJ .. I am not able to find the code for the link you send :(

I think you'll need to check it out from Subversion (for which you'll need an account)

https://jna.dev.java.net/source/browse/jna/
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now