Share on Google+Share on Google+

Avishek Bhattacharyya
Human face using applet programming
1 Answer(s)      7 years ago
Posted in : Applet
import java.applet.*;
import java.awt.*;

public class Chatterjee extends Applet
{
public void init()
{

}
public void paint(Graphics g)
{
g.drawOval(40,40,120,150);
g.drawOval(57,75,30,30);
g.drawOval(110,75,30,30);
g.fillOval(68,81,10,10);
g.fillOval(121,81,10,10);
g.drawLine(100,100,100,117);
g.fillRect(60,139,80,10);
}
}




In da above program,I would like to see the lips which is rectangle change to arc on clicking...or it should turn into smilimg face........How do I proceed using ActionListener..........pls explain....

Ads

View Answers

January 16, 2010 at 1:07 PM


Hi Friend,

Try the following code:

import java.awt.*;
import java.applet.*;

public class HumanFace extends Applet{
private int mouseX, mouseY;
private boolean mouseclicked = false;
public void init(){
}
public void paint(Graphics g){
g.drawOval(40,40,120,150);
g.drawOval(57,75,30,30);
g.drawOval(110,75,30,30);
g.fillOval(68,81,10,10);
g.fillOval(121,81,10,10);
g.drawLine(100,100,100,117);
g.fillRect(60,139,80,10);
if (mouseclicked) {
g.clearRect(60,139,80,10);
g.drawArc(70,100,60,60,0,-180);
mouseclicked = false;
}

}
public boolean mouseDown(Event e, int x, int y ) {
mouseX=x; mouseY=y;
mouseclicked = true;
repaint();
return true;
}
}

Thanks









Related Tutorials/Questions & Answers:
Human face using applet programming - Applet
Human face using applet programming  import java.applet.*; import java.awt.*; public class Chatterjee extends Applet { public void init... is rectangle change to arc on clicking...or it should turn into smilimg face
Human face using applet programming - Applet
Human face using applet programming  import java.awt.*; import java.applet.*; public class HumanFace extends Applet{ private int mouseX, mouseY... would like to know abut this error and its solution.I am using jdk1.3 I would
Advertisements
Create Human Face using Graphics
Create Human Face using Graphics In this section, you will learn how to create human face using Graphics. A Graphics provides contexts that allow...: import java.awt.*; import java.applet.*; public class HumanFace extends Applet
Programming using applets and oracle - Applet
Programming using applets and oracle  Develop an Online Examination software in java using applets as front end and oracle as back end. Software should handle at least ten users at a time. There are Multiple Choice questions
Programming with applet and oracle - Applet
Programming with applet and oracle  Develop an Online Examination software in java using applets as front end and oracle as back end. Software should handle at least ten users at a time. There are Multiple Choice questions
face detection and face recognition
face detection and face recognition   hi,i will create a project detection and recognition of face in java , i create the face detection using opne-cv but i can't create the face reconition can you help me please thanks i
Java Programming - Applet
Java Programming  Write an applet that accepts a string as input and prints it in reverse order.  Hi Friend, Try the following code... Applet implements ActionListener { Label l1,l2,l3; TextField text; Button b
Web programming guidence - Applet
Web programming guidence  Dear Sir/Madam, I have studied (little) Java but not having good knowledge. I wish to host a simple web site. For which I am trying to make a web design. I could make simple web design
By using Applet display a circle in a rectangle
By using Applet display a circle in a rectangle  Write a java applet to display a circle in a rectangle
Write an applet to display scrolling image in an applet window using thread.
Write an applet to display scrolling image in an applet window using thread.  Write an applet to display scrolling image in an applet window using thread
How to convert a old face to young face, old face to young face
going to convert old face of the young face, you can also make it by using... How to convert a old face to young face   ...... Take an Image: First we have to open an old person picture to make young face
How to change the face, change the face
How to change the face       You have a chance to learn how to change the face of the person to another face. It has very simple technique to make this effect
Create SpreadSheet same as excel using java applet
Create SpreadSheet same as excel using java applet  Hi Ji, May i know to create new excel sheet using java Applet
Create SpreadSheet same as excel using java applet
Create SpreadSheet same as excel using java applet  Hi Ji, May i know to create new excel sheet using java Applet
Java Programming using array
Java Programming using array  I'm creating a programming using array that will accept 10 letters and test if those letters are consonant...','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z'}; char ch
Play SWF file using Java - Applet
Play SWF file using Java  Hi I have task to design a screen saver using java. Now, I want to play .SWF (Flash file)in my Applet. Is there any way to play SWF from java class. Any reply will be appreciated. Thanks
java programming using RMI - RMI
java programming using RMI  Write a program using RMI to sell an item to the customer remotely and don't allow the customer to purchase the item if the stock is nil , by displaying an appropriate message
How to make an angry face, make an angry face, angry face
How to make an angry face       We have this example to teach you a simple method to make an angry face... as I have done here. This an angry face. Look here
Applet
Applet  Write an applet to display a string in an applet. String should be passed as a parameter to an applet
Applet
Applet  Give the class hierarchy of an Applet class
applet
applet  Explain different stages in the lifecycle of an applet with figure.   Stages of Applet: Life cycle of an Applet: init(): This method is called to initialized an applet start(): This method is called after
Applet
Applet  how to run an applet on a web browser
applet
applet  What is the immediate superclass of the Applet class
Applet
Applet  Write a ava applet that sets blue color foreground and yellow color background at the start of an applet
Applet
Applet  Explain the start() and stop() methods of applet life cycle.   Start and Start method of Applet Life Cycle Start () method: The start method of an applet is called after the initialization method init
Applet
Applet  I have a java applet that has a button. On clicking the button it should disappear and another applet should appear. How to write this code???? Also in login applet after successful login it should display admin applet
Applet
Applet  Write a short note on applet life cycle
Java programming using ArrayList Help?
Java programming using ArrayList Help?  Hi,can anybody help and guide me on doing this java program? (Largest rows and columns)Write a program that randomly fills in 0s and 1s into an n-by-n matrix,prints the matrix,and finds
Java programming using ArrayList Help?
Java programming using ArrayList Help?  Hi,can anybody help and guide me on doing this java program? (Largest rows and columns)Write a program that randomly fills in 0s and 1s into an n-by-n matrix,prints the matrix,and finds
Applet
Applet  Draw the class hierarchy of an Applet class. Also explain how to set background and forground colors in java
drawing a human in java - Java Beginners
drawing a human in java  i wanna to draw a human in java can u help me how can i draw.? the question is : how to draw a human in java add the nose + the eye + mouth .   where is the answer.? plz i want
Tutorials   
Java Spring Hibernate Struts Training Error in calling javascript function from java prg Creating an Applet java program Display Java in JSP Draw bufferimage in jpanel using netbeans Moving Applet Problem c programming Attendence Management system java program of different shapes help applet printing p applet dought Help please, some strange errors Write an applet to display scrolling image in an applet window using thread. Simple Java applet that need usernam, password and textfield. conversion Applet java program java program java program scrolling text in applet java java applet java applet project in java using applet and servlet...which tool i should use?eclipse or netbeans? java user input to database user input to database user input to database button to accept user input jframe what is web .config method Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone applet question Write an Applet which display current date and time on the web page?? Write an Applet which display current date and time on the web page?? Java Applet - Adding a Button to Decrease a Total Applet Application how to drag top most images which is draw on applet. convert java Application to Java Applet convert java Application to Java Applet Problem In applet Its run on browser but hang and blinking when image is draging some where. how to access database in applet How to add dropdown list in a row of a sort table applet? java project topics plz anyone can solve my Layout Manager Project Guidance applet is running but no display

Ads

 
Advertisement null

Ads