Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
import java.applet.Applet;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
/**
* @author Brebsaron
*/
public class test extends Applet
{
public void init()
{
/**
* Hier kannst Du Deine Komponenten initiallisieren.
* Oder was auch immer ;-)
*/
/**Hier musst Du den Pfad und den Namen Deines Dokumentes eingeben.**/
String text = readfile("Pfad");
System.out.println(text);
}
/**
* Diese Methode liefert den Text des im Parameter angegebenem Dokuments zurück.
* @return Text des Dokumentes
* @param String Pfad
* @author Brebsaron
*/
public String readfile(String Pfad)
{
String Text = "";
int CharInInt = 0;
char Char = 0;
File file = new File(Pfad);
if(!file.exists())
{
try
{
file.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
Text = "Fehler: "+e.toString();
}
}
try
{
FileReader read = new FileReader(file);
while((CharInInt = read.read()) != -1)
{
Char = (char)CharInInt;
Text += Char;
}
}
catch (FileNotFoundException e)
{
e.printStackTrace();
Text = "Fehler: "+e.toString();
}
catch (IOException e)
{
e.printStackTrace();
Text = "Fehler: "+e.toString();
}
return Text;
}
}