GitBucket
4.20.0
Toggle navigation
Sign in
Files
Branches
1
Tags
Issues
4
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
Jonathan
/
KA-Visual
Browse code
Added basic JFrame code.
master
1 parent
dafb379
commit
0f29ab0b0c05c9a005e6e5cbb1caa5b4a86b73cc
Jonathan Ström
authored
on 21 Feb 2017
Patch
Showing
1 changed file
src/mainClass.java
Ignore Space
Show notes
View
src/mainClass.java
import javax.swing.JFrame; import java.net.MalformedURLException; import java.net.URL; import java.io.*; public class mainClass { public static void main(String[] args) { JFrame window = new JFrame(); window.setSize(640, 480); window.setTitle("KA-visual"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); getUrl("http://kryssakuten.se"); } public static void getUrl(String urlString) { URL url; InputStream is = null; BufferedReader br; String line; try { url = new URL(urlString); is = url.openStream(); // throws an IOException br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { System.out.println(line); } } catch (MalformedURLException mue) { mue.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { if (is != null) is.close(); } catch (IOException ioe) { // nothing to see here } } } }
import java.net.MalformedURLException; import java.net.URL; import java.io.*; public class mainClass { public static void main(String[] args) { getUrl("http://kryssakuten.se"); } public static void getUrl(String urlString) { URL url; InputStream is = null; BufferedReader br; String line; try { url = new URL(urlString); is = url.openStream(); // throws an IOException br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { System.out.println(line); } } catch (MalformedURLException mue) { mue.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { if (is != null) is.close(); } catch (IOException ioe) { // nothing to see here } } } }
Show line notes below