Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • SuperNativeZ: 2009SCAPE - Perfect Realistic Emulation. Play Runescape like it was in 2009. [link]
      February 18, 2020, 01:04:45 PM
    • SuperNativeZ: 2009SCAPE - Perfect Realistic Emulation. Play Runescape like it was in 2009. [link]
      February 18, 2020, 01:04:39 PM
    • SuperNativeZ: 2009SCAPE - Perfect Realistic Emulation. Play Runescape like it was in 2009. [link]
      February 18, 2020, 01:04:35 PM
    • ragnoroker: Join RuneGuild Today! BIG DROP PARTY IN 1 HOUR JOIN NOW - Newish Server 30+ Online all the time - Very Unique - Play now : [link]
      February 15, 2020, 04:16:38 PM
    • ragnoroker: Join RuneGuild Today! BIG DROP PARTY IN 1 HOUR JOIN NOW - Discord : [link]
      February 15, 2020, 04:15:41 PM
    • ragnoroker: Join RuneGuild Today! BIG DROP PARTY IN 1 HOUR JOIN NOW :) - [link]
      February 15, 2020, 04:14:50 PM
    • friendlyhelper: Meet up with old and new friends and explore what Runescape Classic could have been had development continued [link]
      February 15, 2020, 03:55:17 PM
    • friendlyhelper: Meet up with old and new friends and explore what Runescape Classic could have been had development continued [link]
      February 15, 2020, 03:49:34 PM
    • friendlyhelper: After well over 6 years of continuous runtime, RSCR still most actively developed RSC server  [link]
      February 15, 2020, 03:49:29 PM
    • SnowRSPS: Checkout Snowrsps.com - Snow317.org - Snowscape.net Open 24.7 [link] !Do not join Galaxy!
      February 15, 2020, 08:15:39 AM
    • SnowRSPS: Checkout Snowrsps.com - Snow317.org - Snowscape.net Open 24.7 [link] !Do not join Galaxy!
      February 15, 2020, 08:15:32 AM
    • SuperNativeZ: GALAXY #1 UNIQUE CUSTOM RSPS [link][link]
      February 14, 2020, 12:27:16 PM
    • SuperNativeZ: GALAXY #1 UNIQUE CUSTOM RSPS [link][link]
      February 14, 2020, 12:27:11 PM
    • SuperNativeZ: GALAXY #1 UNIQUE CUSTOM RSPS [link][link]
      February 14, 2020, 12:27:00 PM
    • ragnoroker: Looking for a new server? Join RuneGuild : [link] You won't be disappointed.
      February 14, 2020, 07:49:42 AM
    • ragnoroker: Looking for a new server? Join RuneGuild : [link] You won't be disappointed.
      February 14, 2020, 07:49:37 AM
    • ragnoroker: Looking for a new server? Join RuneGuild : [link] You won't be disappointed.
      February 14, 2020, 07:49:33 AM
    • Tonystark2830: https: //discord .gg /AHeVSMQ
      February 13, 2020, 11:35:21 AM
    • Tonystark2830:[link]
      February 13, 2020, 11:35:06 AM
    • Tonystark2830:[link] who ever has the most invites will be given money weekly! whats the catch? you must have over 15 invites for the week!  if you are tied with someone else at the end of the week you will both be awarded the same amount "no it will not be split"
      February 13, 2020, 11:34:42 AM

    Author Topic: Adding Icon to Frame (Replacing Java Icon) | Image loaded from Internet  (Read 581 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