Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given a graphics object g, write a few lines of code to have that graphics objec

ID: 3543454 • Letter: G

Question

  1. Given      a graphics object g, write a few lines of code to have that graphics      object draw a green circle (not filled in) that has a diameter of 200      pixels.
  1. Given      a graphics object g, write a few lines of code to draw a blue rectangle      (filled in) with its upper left corner at position 88, 44 with a width of      150 and a height of 200.
  1. How      would you use the Graphics class to draw a line between the points 50,100      and 25,75? Give the Java statement needed.
  1. Describe      the graphical coordinate system in Java. Where is the origin? What units      apply to the x,y coordinates?
  1. How      would you create a Monospaced font of point size 16 that is italic? Give      the Java statement needed.
  1. How do      you specify that the color red will be used as fill when using the      Graphics class? Give the Java statement needed.
         
         
  2. What      does invoking the base class paintComponent method accomplish?
  1. What      is the paintComponent method? How is it used in Java graphics? How does a      program intentionally cause the paintComponent method to execute?
         
         
  2. What      window events can a program handle? Explain the difference between the      WindowListener interface and the WindowAdapter.
         
         
  3. What      interface does an application need to use if it wants to get updates on      the current position of the mouse cursor as the mouse is being moved? How      does the program get the x,y coordinates of the mouse cursor?

Explanation / Answer

Dear,


Hello,

You have posted multiple questions(>7). Replying you with 2 answers. Please do post remaining new posts so that we can help you...


1)
     //Set color
     g.setColor(Color.green);

     g.drawOval(10,10,100,100);

2)    //Set color
    g.setColor(Color.green);

       g. fillRect(88,44,150,200);

Hope this will help you..



Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote