Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • drubrkletern: be honest with me boss
      December 06, 2019, 01:31:52 AM
    • drubrkletern: now is it really that unique
      December 06, 2019, 01:31:47 AM
    • SuperNativeZ: COME PLAY THE MOST UNIQUE CUSTOM RSPS #1 [link][link][link]
      December 05, 2019, 09:22:55 PM
    • SuperNativeZ: FASTEST GROWING #1 UNIQUE CUSTOM RSPS [link][link][link]
      December 05, 2019, 09:22:42 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 60+ online : [link]
      December 05, 2019, 02:48:39 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      December 05, 2019, 02:48:31 PM
    • Cole1497: you click any of these links? those boner pills theyre selling are wicked
      December 04, 2019, 05:58:03 PM
    • Cole1497: oh shit vain whats crackin
      December 04, 2019, 05:57:49 PM
    • ArtexAdv: FASTEST GROWING #1 UNIQUE CUSTOM RSPS [link]
      December 04, 2019, 06:30:27 AM
    • Vain_: where the boys at
      December 01, 2019, 03:20:36 PM
    • black evil111: They should close this down, mostly the downloads section. The mods dont know how to do their jobs worth shit and its no excuse like "we have real life stuff going on" everyones replacable. Speaking of replacable, fix download links! Before I go to rune-server.
      December 01, 2019, 01:50:26 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      November 28, 2019, 12:41:24 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      November 28, 2019, 12:40:42 PM
    • 1strangler77: how do i post pictures on a post
      November 24, 2019, 05:16:18 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      November 23, 2019, 08:23:51 PM
    • Freja1793: Hi
      November 22, 2019, 07:58:41 PM
    • xdarklordxx: JOIN NOW [link]
      November 22, 2019, 03:19:16 PM
    • xdarklordxx: RUNITY IS BACK AND BETTER THAN EVER VERY NICE STAFF AND TONS OF CUSTOMS!!
      November 22, 2019, 03:18:36 PM
    • xdarklordxx: >!https://dl.dropbox.com/s/9iwtazv703mpqsw/LmfaoScape.jar<!
      November 22, 2019, 03:17:04 PM
    • Shadow Monarch: where do i get a client and source
      November 19, 2019, 11:17:48 PM

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