Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      Today at 12:52:54 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      Today at 12:52:50 PM
    • U Go Home: hey does anyone have allstarscape v2 i want to make it better something to do and try and bring back the good old days
      Today at 09:22:14 AM
    • ArtexAdv:[link] come check out the most
      November 18, 2019, 11:39:14 AM
    • ArtexAdv: Www.galaxy-rsps.net come check out the most unique custom rsps
      November 18, 2019, 11:38:50 AM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:59 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:50 PM
    • Mazeingmaze: last logged in 2008
      November 17, 2019, 06:46:52 PM
    • Mazeingmaze: Ayy BRO
      November 17, 2019, 06:46:46 PM
    • SuperNativeZ: WANT TO BE APART OF THE BEST RSPS? [link]
      November 17, 2019, 12:22:53 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:42 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:39 AM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:05 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:01 PM
    • Cole1497: join horney scape we are horney all the time and have a sex emote
      November 09, 2019, 05:14:33 PM
    • thewraith500: try autoscape,0rg brand new osrs CUSTOMS server! fight caves for flaming fire cape, upgrade them to infernal wings + more!
      November 09, 2019, 01:37:29 AM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:24 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:17 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:14 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild - [link]
      November 07, 2019, 11:55:44 AM

    Author Topic: Adding Icon to Frame (Replacing Java Icon) | Image loaded from Internet  (Read 557 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineRiiPiiNFtW

    • Member
    • ****
    • Posts: 5,791
    • Thanks: +0/-0
      • View Profile
    This is my way of adding an icon to replace the default java icon on your client or any other program you want to use this with (written in Java of course).

    This could be done easier, but this is my work around for people getting the icon from their website with cloudflare enabled.

    You could simply do:

    Code: Java
    1. ImageIO.read(newURL(";));

    but again, this is for people with cloudflare enabled (works without it too)

    So here anyways...

    Code: Java
    1.         try{
    2.                         URL url =newURL(";);
    3.                         URLConnection urlConn = url.openConnection();
    4.                         urlConn.addRequestProperty("User-Agent",
    5.                                         "Mozilla/5.0(Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0");
    6.                         BufferedInputStream in = new BufferedInputStream(
    7.                                         urlConn.getInputStream());
    8.                         ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
    9.                         int c;
    10.                         while ((c = in.read()) != -1) {
    11.                                 byteArrayOut.write(c);
    12.                         }
    13.  
    14.                         Image image = Toolkit.getDefaultToolkit().createImage(
    15.                                         byteArrayOut.toByteArray());
    16.  
    17.                         i = new ImageIcon(image);
    18.                 } catch (IOException e) {
    19.                         e.printStackTrace();
    20.                 }
    21.                 setIconImage(i.getImage());
    Runescape Gambling

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal