Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2003, 09:03 PM
Authorized User
Points: 78, Level: 1
Points: 78, Level: 1 Points: 78, Level: 1 Points: 78, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Socorro, NM, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Plotting a graph on a Java Applet

Hi,
   First of all, I would like to thank all Wrox members for having this web site back again, we really missed it!!!. Thank you for your efforts.:D

   I have a problem where I have to draw a graph on an applet using some data in a text file. I would need to design an applet where I can display the graph and the data on the same applet. I had a hard time writing some code in Java to read the text file since I am novice in Java. Now, I am really stuck in how to take this data and graph it on an applet. I don't know which class to use for drawing the graph and how to scale it and draw the actual points or designing the applet itself. I would appreciate if someone can help me out by any suggestions or comments

 Thank you
 
Old June 12th, 2003, 08:04 AM
Authorized User
 
Join Date: May 2003
Location: New Delhi, Delhi, India.
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
To draw a graph in an Applet u need to use the Graphics class present in the AWT package. Graphics class drawRect(),drawString(),drawLine() methods can be used to draw a Graph in an applet. Reading a text file directly from an applet can't be done because Applet run in a sandbox and for security reasons Applet is not allowed to access the System resources.I guess if u are using Applets you must be creating a web based application which will run on Internt or a local intranet and this must involve a web server also if iam right.If this is the case i suggest you to write a JSP or a Servlet for this and let the applet communicate with the Server application and get the data u need.

hope this helps

Regards

Yashraj Chauhan
Java\J2EE Specialist
Wiley Support Team




Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Applet - Search with Slider options itHighway Classic ASP Basics 0 June 10th, 2006 02:49 AM
close java applet causes browser to crash Thomanji Ajax 0 February 24th, 2006 10:25 AM
Plotting graph using Infragistics NetAdvantage 5 dotnetprogrammer VS.NET 2002/2003 0 June 1st, 2005 07:11 AM
java applet trick convet to c# chall3ng3r General .NET 0 February 8th, 2005 11:22 PM
display element (layer) over java applet mateenmohd Java GUI 0 January 6th, 2004 12:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.