Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

31
LINES

< > BotCompany Repo | #1006596 // enableSubstance_impl

JavaX fragment (include)

lib 1005652 // Substance
lib 1003441 // Trident (required by Substance)

import org.pushingpixels.substance.api.*;
import org.pushingpixels.substance.api.skin.*;

static void enableSubstance_impl(fS skinName) {
  if (headless()) ret;
  swing {
    if (!substanceLookAndFeelEnabled())
      enableSubstance_impl_2(skinName);
  }
}

static void enableSubstance_impl_2(S skinName) ctex {
  bool wasEnabled = substanceLookAndFeelEnabled();
  ClassLoader cl = main.class.getClassLoader();
  UIManager.getDefaults().put("ClassLoader", cl);
  Thread.currentThread().setContextClassLoader(cl);
  S skinClassName = "org.pushingpixels.substance.api.skin." + addSuffix(skinName, "Skin");
  SubstanceSkin skin = (SubstanceSkin) nuObject(cl.loadClass(skinClassName));
  SubstanceLookAndFeel.setSkin(skin);
  JFrame.setDefaultLookAndFeelDecorated(true);  
  updateLookAndFeelOnAllWindows_noRenew();
  if (!wasEnabled) renewConsoleFrame();
  
  if (substanceLookAndFeelEnabled()) {
    //print("Substance L&F enabled.");
  } else
    print("Could not enable Substance L&F?");
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006596
Snippet name: enableSubstance_impl
Eternal ID of this version: #1006596/7
Text MD5: 49f1dbcd2811bbb5c171e2ac5d3ee050
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-20 14:56:16
Source code size: 1092 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 577 / 696
Version history: 6 change(s)
Referenced in: [show references]