Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 27th, 2003, 01:35 PM
mr_mcoy mr_mcoy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 mr_mcoy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
fails to compile :(

Hi.. im having a problem compiling my program... would really appriciate some help!
here's the code

"

import java.awt.*;
import java.net.URL.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import java.io.*;




public class Line extends JApplet {
int lasty=0;
int lastx=0;
int biggest=0;
int yintervall;
int punktery[]=new int[5];
StringBuffer buff;
String apa = "a";
String skilj ="|";
int b=0;


public void paint(Graphics g) {

try {
URL u=new URL("http://www.sweform.com/graf_data.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(u.openStream()));
buff=new StringBuffer();
String line;
while ((line = in.readLine()) != null)
buff.append(line);
in.close();

} catch (MalformedURLException e) {}

int end,start=0;
for(int i=0; i<punktery.length; i++) {
start=buff.indexOf(skilj,start);
end=buff.indexOf(skilj,start);
String mini=buff.substring((start+1),end);
int convInt= new Integer(mini).intValue();
punktery[i]=convInt;

if(punktery[i]>biggest)
biggest=punktery[i];
}

yintervall=biggest/6;

Graphics2D g2 = (Graphics2D) g;

g2.draw(new Line2D.Double(10, 0,
10, 180));
g2.draw(new Line2D.Double(10, 180,
180, 180));

for(int i=0; i<180; i+=30)
g.drawString(apa, 0, i);

Integer c=new Integer(b);
for(int i=10; i<180; i+=30) {
g.drawString(c.toString(), i, 190);
b++;
c=new Integer(b);
}


for(int i=0; i<punktery.length; i++) {
g2.draw(new Line2D.Double(10+lastx, (180-lasty),
10+i, (180-punktery[i])));
lasty=punktery[i];
lastx=i;
}

}
}

"

the compiler gives me the following errors

line.java:26: cannot resolve symbol
symbol : class URL
location: class Line
URL u=new URL("http://www.sweform.com/graf_data.txt");
^
line.java:26: cannot resolve symbol
symbol : class URL
location: class Line
URL u=new URL("http://www.sweform.com/graf_data.txt");
^
line.java:34: cannot resolve symbol
symbol : class MalformedURLException
location: class Line
} catch (MalformedURLException e) {}
^
3 errors

Reply With Quote
  #2  
Old April 27th, 2003, 09:10 PM
Kapil Kapil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Bogotá, Colombia
Posts: 43 Kapil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Kapil Send a message via AIM to Kapil Send a message via Yahoo to Kapil
You have to import java.net.*, as the URL and MalformedURLException classes are defined in that package.

Reply With Quote
  #3  
Old April 28th, 2003, 10:15 AM
mr_mcoy mr_mcoy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 mr_mcoy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thnx

thanks!
it does compile now however im not sure that the code extracts the numbers between the "|" signs (check the url in the code).... is the code correct?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > fails to compile :(


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway