2016-12-14 7 views

答えて

1

あなたはFigureを拡張する必要が丸い四角形を描画し、この図の内側に丸みを帯びたボーダー

免責で四角形を描画するに案内してください - これは私が使用したコードの縮小版であります私はそれを試していませんでした。)

public class RoundedRectangle extends Figure { 
    private final RoundedRectangle rectangle; 

    public RoundedRectangle() { 
     super(); 
     setLayoutManager(new XYLayout()); 
     rectangle = new RoundedRectangle(); 
     rectangle.setCornerDimensions(new Dimension(20, 20)); // This is where the rounding happens 
     // Anything else you want to customize 
     add(rectangle); 
    } 

    @Override 
    protected void paintFigure(Graphics graphics) { 
     Rectangle r = getBounds().getCopy(); 
     setConstraint(rectangle, new Rectangle(0, 0, r.width, r.height)); 
    } 
} 
関連する問題