Code Written Java Please Using Gui Comments Explanations Appreciated Q37197702

The code should be written in java please using GUI. Somecomments with explanations will be appreciated.

P10.17 Write a program to plot the following face. Provide a class Faceviewer and a class FaceComponent.

P10.17 Write a program to plot the following face. Provide a class Faceviewer and a class FaceComponent. Show transcribed image text P10.17 Write a program to plot the following face. Provide a class Faceviewer and a class FaceComponent.


Answer


import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;

class FaceComponent extends Canvas
{
public void paint(Graphics g)
{
g.drawOval(120,110,100,110);
g.drawOval(140,140,10,10);
g.drawOval(190,140,10,10);
g.drawLine(145,185,195,185);
}
}

class FaceViewer
{
public static void main(String args[])
{
FaceComponent fc=new FaceComponent();
JFrame f1=new JFrame(“Face”);
f1.setSize(350,350);
f1.setVisible(true);
f1.add(fc);
f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

t PS C: Usersluser Desktop javac FaceViewer. java PS C: UsersluserDesktop java FaceViewer s Face Activate Windows Go to Se

t

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.