D@rk-€vil™
08.05.2010, 20:34
So hallo ihr junkys..........also bin ja schon ne weile zugange ne Java Version vom SourceDL zubauen....
so nun folgendes Problem habe ich.......
hier ma nen Code wie ich ihm nun habe
import javax.swing.*;
import javax.swing.text.*;
import java.awt.event.*;
import java.awt.*;
import java.io.File;
public class nv2006 extends JFrame {
private JEditorPane jep;
public nv2006(String startingUrl) {
super("nv2006");
setSize(400,300);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel urlPanel = new JPanel();
urlPanel.setLayout(new BorderLayout());
JTextField urlField = new JTextField(startingUrl);
urlPanel.add(new JLabel("Download: "), BorderLayout.WEST);
urlPanel.add(urlField, BorderLayout.CENTER);
final JLabel statusBar = new JLabel(" ");
jep = new JEditorPane();
jep.setEditable(false);
try {
jep.setPage(startingUrl);
}
catch(Exception e) {
statusBar.setText("Could not open starting page. Using a blank.");
}
JScrollPane jsp = new JScrollPane(jep);
getContentPane().add(jsp, BorderLayout.CENTER);
getContentPane().add(urlPanel, BorderLayout.NORTH);
getContentPane().add(statusBar, BorderLayout.SOUTH);
urlField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
jep.setPage(ae.getActionCommand());
}
catch(Exception e) {
statusBar.setText("Error: " + e.getMessage());
}
}
});
jep.addHyperlinkListener(new SimpleLinkListener(jep, urlField,
statusBar));
}
public static void main(String args[]) {
String url = "";
if (args.length == 1) {
url = args[0];
if (!(url.startsWith("http:") || url.startsWith("file:"))) {
if (url.startsWith("/")) {
url = "file:" + url;
}
else {
try {
File f = new File(url);
url = f.toURL().toString();
}
catch (Exception e) {
url = "http://blablab.eu";
}
}
}
}
else {
url = "http://blablab.eu";
}
new nv2006(url).setVisible(true);
}
}
aber des funzt kommischerweise nicht........vielleicht kann ja ma jemand von euch ma drüber schauen....
Lg Dark
so nun folgendes Problem habe ich.......
hier ma nen Code wie ich ihm nun habe
import javax.swing.*;
import javax.swing.text.*;
import java.awt.event.*;
import java.awt.*;
import java.io.File;
public class nv2006 extends JFrame {
private JEditorPane jep;
public nv2006(String startingUrl) {
super("nv2006");
setSize(400,300);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel urlPanel = new JPanel();
urlPanel.setLayout(new BorderLayout());
JTextField urlField = new JTextField(startingUrl);
urlPanel.add(new JLabel("Download: "), BorderLayout.WEST);
urlPanel.add(urlField, BorderLayout.CENTER);
final JLabel statusBar = new JLabel(" ");
jep = new JEditorPane();
jep.setEditable(false);
try {
jep.setPage(startingUrl);
}
catch(Exception e) {
statusBar.setText("Could not open starting page. Using a blank.");
}
JScrollPane jsp = new JScrollPane(jep);
getContentPane().add(jsp, BorderLayout.CENTER);
getContentPane().add(urlPanel, BorderLayout.NORTH);
getContentPane().add(statusBar, BorderLayout.SOUTH);
urlField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
jep.setPage(ae.getActionCommand());
}
catch(Exception e) {
statusBar.setText("Error: " + e.getMessage());
}
}
});
jep.addHyperlinkListener(new SimpleLinkListener(jep, urlField,
statusBar));
}
public static void main(String args[]) {
String url = "";
if (args.length == 1) {
url = args[0];
if (!(url.startsWith("http:") || url.startsWith("file:"))) {
if (url.startsWith("/")) {
url = "file:" + url;
}
else {
try {
File f = new File(url);
url = f.toURL().toString();
}
catch (Exception e) {
url = "http://blablab.eu";
}
}
}
}
else {
url = "http://blablab.eu";
}
new nv2006(url).setVisible(true);
}
}
aber des funzt kommischerweise nicht........vielleicht kann ja ma jemand von euch ma drüber schauen....
Lg Dark