V I J E S H
V I J E S H

Reputation: 7594

changing the shape of jframe

I don't know whether it is possible or not.Is there any way to change the shape of jframe into circle

Upvotes: 2

Views: 3179

Answers (2)

Imtiyaz Ansari
Imtiyaz Ansari

Reputation: 11

//You can change the shape of JFrame import java.awt.geom.*;

setUndecorated(true);
Ellipse2D.Double E=new Ellipse2D.Double(0,0,500,500); //nested class Double## 

 - Heading

 ##
setShape(E);
setVisible(true);

Upvotes: 1

Bernd Elkemann
Bernd Elkemann

Reputation: 23560

Essentially what you have to do is make the outer part of your JFrame rendered surface transparent and then draw your own custom shape in the middle.

This will get you started:

http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/

And this is a finished implementation:

http://www.codeproject.com/KB/java/shaped-transparent-jframe.aspx

Upvotes: 5

Related Questions