This code is in a class and it gets the source code from a website. I would like get the code and print it out in a jTextArea that is in another class, but i have no idea how i can do that. how can i export this source code in another class?
public static void Connect() throws Exception{
URL url = new URL("https://www.google.com/");
URLConnection spoof = url.openConnection();
spoof.setRequestProperty( "User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; H010818)" );
BufferedReader in = new BufferedReader(new InputStreamReader(spoof.getInputStream()));
String strLine = "";
while ((strLine = in.readLine()) != null){
System.out.println(strLine);
}
}
in the other class I have a button with this code:
try{
Connect();
} catch(Exception e) {
}
JTextArea?