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.

Plz give solution as soon as possible.

Good info here and here

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);
        setBackground(Color.BLACK);
    }

    @Override public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.red);
        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){
            frame.setVisible(false);
      }
});


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.

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.setUndecorated(true);
myJFrame.setShape(new Ellipse2D...  <params to define the circle you want>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.