Can i create GUI in round shape wihtout title bar by extending JFrame class in java.

I want circular shape instead of default rectangle.
How can i do this?

Plz give solution as soon as possible.

6 Years
Discussion Span
Last Post by JamesCherrill

Java swing and the look and feel library have a number of features that would be useful for this sort of development. It is also useful to look into overriding the Jframe class that makes standard JFrame for your application and reset its background opacity etc to match your needs.

public class JFrame2 extends JPanel {

    public JFrame2() {
        setSize(200, 100);

    @Override public void paintComponent(Graphics g) {
        g.fillRect(0, 0, 100, 100);

Something alone those lines might be useful, however i have not tried it. I know it to be possible as i have seen it done in examples. Also noteworthy is that you should look into using event listeners to add basic open and close functionality to your custom frame using something like this :

frame.addWindo wListener(new WindowAdapter(){

      public void windowIconified(WindowEvent e){

Other useful links maybe :
http://www.devdaily.com/blog/post/jfc-swing/transparent-translucent-java-frame-jframe-mac-slider http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/synth.html http://www.codeproject.com/Articles/117047/Arbitrary-Shaped-Transparent-JFrame-in-Java-Swing

The last one is particularly useful, anyway hope this helps.

Edited by trishtren


That last ref is very useful - but note that it uses the pre-release methods in AWTUtilities. These methods were "moved" into the mainstream classes with Java 7 (version 1.7), so if yu want to do shaped windows you should be sure to upgrade to 1.7 and stick to released APIs.

No need to create any custom classes, just

myJFrame.setShape(new Ellipse2D...  <params to define the circle you want>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.