simple static/non-static problem...need help!
Hello!
I have a problem thats is very simple but just can't fix it..
When i call visaSida() in the main Webbscrape-class i can't do that because it is calling a non static method in the innerclass, Webblasare. If I make the visaSida static it can't perform the setPage() inside of it because its not static. I have never really understood the static-thing either... whats its use?
tnx
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
public class Webbscrape extends JFrame implements ActionListener{
Webblasare Jep = new Webblasare();
JTable Jt = new JTable(50,2);
JScrollPane Jsp_links;
JScrollPane Jsp_webb;
JTextField url = new JTextField();
public Webbscrape(){
Container c = getContentPane();
url.addActionListener(this);
Jsp_links = new JScrollPane(Jt);
Jsp_webb = new JScrollPane(Jep);
add(url, BorderLayout.PAGE_START);
add(Jsp_links, BorderLayout.LINE_END);
add(Jsp_webb, BorderLayout.CENTER);
setSize(850,500);
setLocation(100,100);
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
Webblasare.visaSida(url.getText());
}
public static void main(String[] args) {
Webbscrape wb = new Webbscrape();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public class Webblasare extends JEditorPane {
public Webblasare(){
super();
}
public void visaSida(String url) {
String newUrl = url;
try {
setPage(newUrl);
}
catch(Exception e){}
}
}
}

