E
Evomania
Gast
huhu,
habe folgendes prob, ich will das java in den ordner schaut wo die class datei liegt ohne exakte pfad angabe....
Bsp:
Edit deathbyaclown: Code Tags eingefügt
habe folgendes prob, ich will das java in den ordner schaut wo die class datei liegt ohne exakte pfad angabe....
Bsp:
Code:
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.net.URL;
public class help extends JDialog
{
JEditorPane hilfe = new JEditorPane();
String inhalt = "";
URL url = null;
public static void main(String[] args)
{
new help();
}
public help()
{
initGUI();
}
public void initGUI()
{
this.setTitle("Hilfe für Autohausverwaltung");
this.getContentPane().setLayout(null);
this.setSize(700,700);
this.setResizable(false);
try
{
System.out.println(System.getProperty("user.path"));
[color=red]url = new URL("file:/m:/help.htm>");[/color]
}
catch(java.net.MalformedURLException e)
{
url = null;
System.out.println("Fehlerhafte Url"+e);
}
try
{
hilfe.setPage(url);
}
catch(IOException e)
{
System.out.println("Fehler bei anzeige der Seite"+e);
}
hilfe.setEditable(false);
hilfe.setBounds(0,0,700,700);
hilfe.addHyperlinkListener(new hyperlinkA(this));
this.getContentPane().add(hilfe);
this.setVisible(true);
}
void hyperlink(HyperlinkEvent he)
{
try
{
hilfe.setPage(he.getURL());
}
catch(IOException e)
{
System.out.println("Fehler"+e);
}
}
}
class hyperlinkA implements HyperlinkListener
{
help obj;
hyperlinkA(help obj)
{
this.obj = obj;
}
public void linkUpdate(HyperlinkEvent e)
{
obj.hyperlink(e);
}
public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent hyperlinkEvent) {
}
}
Edit deathbyaclown: Code Tags eingefügt