Complete the following programs//program//import JApplet from the library javax.
ID: 3573262 • Letter: C
Question
Complete the following programs//program//import JApplet from the library javax.swing//import all the classes from the library java.awt public class Rings extends JApplet {/** *creates a new instance of Rings */public Rings() {} public static final int RING_DIAMETER = 40; public void paint (Graphics canvas) {super.paint(canvas);//set the object canvas to blue canvas drawOval (0, 0, RING_DIAMETER, RING_DIAMETER);}}//Program 2//import all the classes from the library javax.swing public class JOptionPaneYesNoDemo extends JApplet {public static void main (String[] args) {//what does the following statement do? int answer = JOptionPane.showConfirmDialog(null, End program?", Click Yes or No:" JOptionPane. YES_NO_OPTION); write a statement that will quit the program if the Yes option on the confirmation window if chosen else if (answer == JOption Pane.NO_OPTION) system.out.println ("one more time"); else System.out.println ("This is impossible");Explanation / Answer
A.
Answer:
import javax.swing.JApplet;
b.
Answer:
all classes imported by
import java.awt.*;
or for given program
import java.awt.Color;
import java.awt.Graphics;
c.
Answer:
canvas.setColor(Color.blue);
d.
Answer:
all classes imported by
import java.swing.*
or for given program
import javax.swing.JApplet;
import javax.swing.JOptionPane;
e.
Answer:
It prompt a confirm dialog box with two button yes or no with title Click Yes or No:
Thanks a lot