| |
16. 41. 10. Ractangle with rounded corners drawn using Java 2D Graphics API |
|
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;
public class Main extends javax.swing.JFrame {
public Main() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setSize(600,600);
}
public void paint(Graphics g) {
Graphics2D graphics2 = (Graphics2D) g;
RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(100, 100, 240, 160, 10, 10);
graphics2.draw(roundedRectangle);
}
public static void main(String args[]) {
new Main().setVisible(true);
}
}
|
|
|