Solved

Very easy question + 200 points.

Posted on 2002-03-03
7
176 Views
Last Modified: 2011-09-20
Hi


I need to see an applet that does the following please:
display an image.
allows me to drag it up, down, left, and right.

I want you to identify which commands in the code that allows me to drag the image.
Thanks alot
0
Comment
Question by:aja101498
7 Comments
 
LVL 3

Expert Comment

by:daitt
ID: 6838325
Sounds like a homework question.
Build an applet. In start() function, load the image. In paint(Graphics g) function, draw the image.
Catch mouseDown(MouseEvent e), mouseUp(MouseEvent e), mouseDragged(MouseEvent e) to change the coordinate of the image, and repaint.
If you have problem with any of the things below, please ask.
0
 

Author Comment

by:aja101498
ID: 6839247
No I am not student I am start learning Java and I couldn't find this in box.
All I want is to see an example. Thanks
0
 
LVL 3

Expert Comment

by:daitt
ID: 6840347
Please try to build the applet step by step. I think this is a good way to learn java.
1. Create an empty applet, test it.
2. Load the image (in init() function of the applet) and display it (in paint function of the applet). Test the applet.
3. Catch onMouseDown and onMouseDragged to move the image. Test the applet.
4. Catch onMouseExited to reset mouse status when user move out of the applet. Test the applet.

You can ask if you have any problem with the steps above.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 4

Accepted Solution

by:
sanjay_thakur earned 200 total points
ID: 6840356
0
 
LVL 8

Expert Comment

by:Exceter
ID: 7384860
Pardon our critisism but you must understand that we have many students that attempt to get us to do their homework for them.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8658254
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to sanjay_thakur

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apps blocked by Java 9 88
MySQL  on Tomcat 8 68
jsp insert to database example 2 46
Need Help! Getting a syntax error and don't understand why 3 31
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question