It compiles now but still no display. Sorry for all the questions really
trying to learn this.
import java.util.Scanner;
import java.io.*;
import javax.swing.JApplet;
import java.awt.*;
public class URLDissector extends JApplet
{
String[] names;
String url;
Scanner fileScan, urlScan;
int i = 0;
//-----------------------------------------------------------------
// Reads urls from a file and prints their path components.
//-----------------------------------------------------------------
public void init()
{
try{
readFile();
}
catch (Exception IOexception){}
}
public void readFile() throws IOException
{
fileScan = new Scanner (new File("pictures.txt"));
// Read and process each line of the file
while (fileScan.hasNext())
{
// url = fileScan.nextLine();
names[i] = fileScan.nextLine();
System.out.println (names[i]);
i++;
}
}
}
> It compiles now but still no display. Sorry for all the questions really
> trying to learn this.
[quoted text clipped - 38 lines]
>
> }
It displays to the system console. If you're running it in a webbrowser,
you have to use the browser's "view console" feature to view the output. If
you want the output to display in the applet itself, you're going to have to
learn how to write a GUI, which isn't difficult, but it isn't trivial
either.
If you've never done GUIs before, start off by writing normal
applications instead of applets at first. Applets will just add an extra
layer of difficulty while trying to learn GUIs.
Read this tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/index.html
- Oliver