0

For some time now I was trying to make a JFrame with rounded borders however I was not able to.

I know the setShape(java.awt.Shape) method of a JFrame can be used to create JFrame with specific shape but I guess it is limited to the following:

  • Rectangle2D (sharp-edged)
  • Ellipse2D
  • CubicCurve2D
  • QuadCurve2D
  • GeneralPath
  • What I want to do is to create a JFrame with rounded corners.
    How is that possible ?

    Note: My Eclipse IDE shows the setShape() method however the Java Doc online does not. Uhm... why ?

    mKorbel
    • 109,525
    • 20
    • 134
    • 319
    An SO User
    • 24,612
    • 35
    • 133
    • 221
    • 1
      Look here could be help [Create a rounded JFrame / ContentPane](http://stackoverflow.com/questions/954566/create-a-rounded-jframe-contentpane) – Smit May 16 '13 at 17:56
    • @Smit The article on today.java.net uses `AWTUtilties` for setting the shape which has been replaced by `setShape()` :) – An SO User May 16 '13 at 17:58
    • [notice for Java7](http://stackoverflow.com/questions/16219111/cant-transparent-and-undecorated-jframe-in-jdk7-when-enabling-nimbus) – mKorbel May 16 '13 at 18:02
    • I do not want a circular JFrame, I want a rectangle with rounded corners – An SO User May 16 '13 at 18:04
    • 1
      I do not want a circular JFrame == nobody talking about, I want a rectangle with rounded corners == is possible – mKorbel May 16 '13 at 18:08
    • 1
      *"I want a rectangle with rounded corners"* See **[`RoundRectangle2D`](http://docs.oracle.com/javase/7/docs/api/java/awt/geom/RoundRectangle2D.html)**. – Andrew Thompson May 17 '13 at 03:21

    0 Answers0