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

31
LINES

< > BotCompany Repo | #1006596 // enableSubstance_impl

JavaX fragment (include)

1  
lib 1005652 // Substance
2  
lib 1003441 // Trident (required by Substance)
3  
4  
import org.pushingpixels.substance.api.*;
5  
import org.pushingpixels.substance.api.skin.*;
6  
7  
static void enableSubstance_impl(fS skinName) {
8  
  if (headless()) ret;
9  
  swing {
10  
    if (!substanceLookAndFeelEnabled())
11  
      enableSubstance_impl_2(skinName);
12  
  }
13  
}
14  
15  
static void enableSubstance_impl_2(S skinName) ctex {
16  
  bool wasEnabled = substanceLookAndFeelEnabled();
17  
  ClassLoader cl = main.class.getClassLoader();
18  
  UIManager.getDefaults().put("ClassLoader", cl);
19  
  Thread.currentThread().setContextClassLoader(cl);
20  
  S skinClassName = "org.pushingpixels.substance.api.skin." + addSuffix(skinName, "Skin");
21  
  SubstanceSkin skin = (SubstanceSkin) nuObject(cl.loadClass(skinClassName));
22  
  SubstanceLookAndFeel.setSkin(skin);
23  
  JFrame.setDefaultLookAndFeelDecorated(true);  
24  
  updateLookAndFeelOnAllWindows_noRenew();
25  
  if (!wasEnabled) renewConsoleFrame();
26  
  
27  
  if (substanceLookAndFeelEnabled()) {
28  
    //print("Substance L&F enabled.");
29  
  } else
30  
    print("Could not enable Substance L&F?");
31  
}

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: 632 / 755
Version history: 6 change(s)
Referenced in: [show references]