我想给jpanel添加一个圆角的边框,请问如何绘制?多谢。

解决方案 »

  1.   

    如果是那样的话
      你可以计算一下
      用drawLine和drawRect方法 找出八个点 连接起来就OK拉
      

  2.   

    LineBorder 支持圆角
    LineBorder(Color color, int thickness, boolean roundedCorners)             int offs = this.thickness;
                int size = offs + offs;
                if (this.roundedCorners) {
                    int arc = offs + size;
                    outer = new RoundRectangle2D.Float(x, y, width, height, arc, arc);
                    inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
                }