Answer to Question #227536 in Java | JSP | JSF for umme habiba sumi

Question #227536

Write a statement to draw a rounded rectangle with the following features:

Width = 200 Corner horizontal diameter = 20

Height = 100 Corner vertical diameter = 40

Select the suitable upper-left corner of the rectangle. 


1
Expert's answer
2021-08-22T00:27:38-0400
This is the statement:   g1.drawRoundRect(20, 40, 200, 100, 50, 30);

The code below illustrates the usage of the above statement.



package roundedrectangle;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;






public class RoundedRectangle extends JFrame{


    public void paint(Graphics g){
        Graphics2D g1= (Graphics2D) g;
      g1.drawRoundRect(20, 40, 200, 100, 50, 30);
    } 
    public static void main(String[] args) {
        RoundedRectangle rec = new RoundedRectangle();
        rec.setTitle("Rounded Rectangle ");
      rec.setSize(350, 275);
      rec.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      rec.setLocationRelativeTo(null);
      rec.setVisible(true);
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS