Home Answers Viewqa Applet Human face using applet programming

 
 


Avishek Bhattacharyya
Human face using applet programming
1 Answer(s)      3 years and 4 months 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....
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 Pages:
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
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 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
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
What is Applet? - Applet
programming language, an applet is a small program that can be sent along with a Web...What is Applet?  What is Applet?  Hi,Here is a little information about Applet.An applet is a little application. Prior to the World Wide
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
Applet
of a parameter passed to an applet can be retrieved using getParameter() function. E.g.... Applet       Introduction Applet is java program that can be embedded into HTML pages. Java applets
applet - Applet
applet   how to draw textboxes using applets  Hi Friend...*; import java.awt.*; public class CreateTextBox extends Applet implements.../applet/ Thanks
Java Programming: Solution to Programming Exercise
is in progress. The programming of this applet assumes that the applet... Solution for Programming Exercise 7.5 THIS PAGE DISCUSSES ONE... it possible for the user to place bets on the Blackjack game. When the applet starts
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
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 5.5 THIS PAGE DISCUSSES ONE..., the dealer deals himself one card face up and one card face down. All the user's cards are dealt face up.) The user makes a decision whether to "Hit"
Java Programming: Section 5.3
life cycle. The systematic approach to programming, using accepted principles... Section 5.3 Programming with Objects THERE ARE SEVERAL WAYS... as objects. On another level, object-oriented programming encourages programmers
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
Applet : Java Glossary
; An applet in java programming language is a small program that only runs... to an applet that is embedded in a Web page using a special HTML tag. When a reader loads a Web page having an applet in it by using a Java-enabled browser, the browser
how to run applet - Applet
how to run applet   Hi everybody i am using connecting jdbc in applet program. this is executed successfully with appletviewer command >...://www.roseindia.net/java/example/java/applet/ http://www.roseindia.net/java
problem with applet plugin - Applet
problem with applet plugin  hello friends, iam using Eclipse IDE. i created one applet and i want to plugin that applet into webpage.. when i am..... Thanks in advance..  Hi Friend, If you want to plugin applet
methods in the applet - Applet
; public class applet1 extends Applet { String m; public void init... applet is simular to the contructor defined in a java application. The purpose.... 2. Application triggered painting - Invoked by using the repaint() method
I face some problem - Java Beginners
I face some problem  I face some problem in my project plz deepak halp me how can i solve this problem i m using bean and jsp file also. and deployee the using tomcat server plz help me how can i solve thisproblem HTTP Status
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
Java Programming: Section 6.6
put almost all the programming into the display surface class. The applet... there is to GUI programming. If you're willing to program all the drawing and handle... that a button was pushed. Another aspect of GUI programming is laying out
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
applet question
applet question  sir please tell me that how can i call an event on clicking on applet window without using any component
java applet problem - Applet
java applet problem  i was doing a program using java applet. I want... and to exit from the applet respectively.Now i want to display a message when...*; import java.awt.*; public class Calculator extends Applet implements
Java Programming: Section 2.1
knowledge of the syntax of the programming language that you are using... programming environment that you are using. (See Appendix 2 for information... to be written in programming languages. Programming languages differ from
Applet issue
Applet issue  Hello, Can there be any problem in writing a file to the temp directory from a url using applet??? If some security problems are there please do post it for me
Java Programming: Solution to Programming Exercise
. The programming of this applet assumes that the applet is set up... Solution for Programming Exercise 6.8 THIS PAGE DISCUSSES ONE.... Exercise 6.8:Write a Blackjack applet that lets the user play a game
Applet - AOP
Applet  how to run applet using Aspectj or Aspectwerkz at load time... Kundan kundankunal1@rediffmail.com  Hi Kundan Just... is the HTML code for an HTML editor applet that contains some debugging aspects
Java Programming: Section 7.1
compression generally works well for photographs. The Applet class defines a method... be used in the source code of your applet: img = getImage... directory for the applet. Assuming that the applet is in the default package
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 8.4 THIS PAGE DISCUSSES ONE... balls to bounce off the sides of the applet, so you will create them... should create an applet that shows an animation of 25 balls bouncing around
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 6.1 THIS PAGE DISCUSSES ONE.... Exercise 6.1: Write an applet that shows a pair of dice. When the user clicks on the applet, the dice should be rolled (that is, the dice should be assigned
Java Programming: Section 10.4
communication using input streams and output streams, just as you can use.... In an applet, two methods are available that provide useful URL contexts. The method getDocumentBase(), defined in the Applet class, returns an object of type URL
Applet Graph
Applet Graph  hai, iam new to java plz help me.. 1..i have a table... columns-names by using check box and click on graph button, 3..then i have to get a graph between those columns in a applet plz send me the code thank u
Java Programming: Solution to Programming Exercise
. The programming of this applet assumes that the applet... Solution for Programming Exercise 7.4 THIS PAGE DISCUSSES ONE... this change in the Blackjack program. This applet uses a nested class
Java Programming: Section 8.3
be different classes of Players such as computer players, regular human players... for something else. And what if someone is using a computer that could handle as many data... The following applet simulates this program. I've included an output statement
How to remove glass from the face
How to remove glass from the face By this example you will be able... the face, follow every step with concentration to make this effect. Open..., as given below image. Keep using brush, I have removed first glass
Applet - spell check program - Applet
Applet - spell check program  hi, i am writing a applet program -say... ALSO ATTACH THE APPLET PROGRAM I HAVE ALREADY DEVELOPED IF PERMITED... develed using Ternary search tree and finds synonyms, gives words which
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 8.3 THIS PAGE DISCUSSES ONE... expect. Write a little applet that lets the user draw polygons. As the user... to start drawing a new polygon. When the user shift-clicks on the applet
unable to see the output of applet. - Applet
unable to see the output of applet.  Sir, I was going through the following tutorial http://www.roseindia.net/java/example/java/applet...://www.roseindia.net/java/example/java/applet/FirstApplet.html but the problem
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.4 THIS PAGE DISCUSSES ONE.... After that, the user should be able to enter a new expression. Here is an applet.... The conversion from a string, line, to a double is done using a method
Java Programming: Chapter 5 Exercises
Programming Exercises For Chapter 5 THIS PAGE CONTAINS programming exercises based on material from Chapter 5 of this on-line Java textbook... the solution! Exercise 5.2: A common programming task is computing statistics
Java Programming: Section 10.2
, such input and output is done using streams. Human-readable character data is read from a file using an object belonging to the class FileReader, which is a subclass of Reader. Similarly, data is written to a file in human-readable format
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 7.6 THIS PAGE DISCUSSES ONE... for the timer. Here is an applet that tests my solution to this exercise... be confused with a Timer object.) The guidelines for using Timers can be found
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.3 THIS PAGE DISCUSSES ONE.... Exercise 9.3: A Roman numeral represents an integer using letters. Examples... can tell the difference by using TextIO.peek() to peek at the first character
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 7.2 THIS PAGE DISCUSSES ONE.... Exercise 7.2: Write an applet with a JTextArea where the user can enter some text. The applet should have a button. When the user clicks on the button
Java Programming: Solution to Programming Exercise
by using it in a simple applet that sets the component to a random color when... Solution for Programming Exercise 7.3 THIS PAGE DISCUSSES ONE.... Exercise 7.3: The RGBColorChooser applet lets the user set the red, green
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 7.7 THIS PAGE DISCUSSES ONE.... Exercise 7.7: The applet at the end of Section 7.7 shows animations.... Symmetric patterns are pretty. Make the SimplePaint3 applet do symmetric
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 4.5 THIS PAGE DISCUSSES ONE.... The applet at the bottom of Section 4.7 shows a variation on this idea. In this applet, all the squares start out with the default color, black. Every time
Applet run with appletviewer but not in browser, any code problem.
Applet run with appletviewer but not in browser, any code problem.  Hi,My problem is when I am running my applet in appletviewer index.html, Its work.../index.html I am using "dynamic web application" in eclipse. I want all
java applet prog
java applet prog  applet to display scrolling text from right to left in an applet window using thread. text should be accepted by html parameter

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.