This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: 11 Jan 16, 18:47 Last Post By: JeffTucker
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Getting skinDirectory from a customUI
Posted: 9 Jan 16, 07:44
 
  Click to reply to this thread Reply
I've got a TestGUI skin that has a custom panel. So, TestGUICustomUI.java has something like this:
class TestGUICustomUI extends JCustomPanel {
// Fields
    JComboBox<String> showStyles = new JComboBox(new String[]{});
    {
	   JAlbumUtilities.fillCombo(showStyles, new File(skinDirectory, "styles"), new StyleFileFilter());
    }
// Set up custom UI panel
    public TestGUICustomUI(JAlbumContext context) {
	   super(context);
....etc.
But the skinDirectory variable is not recognized here. In TestGUI.java, which extends CompiledBase, there's no problem.

How do I get the skin directory from here? My usual trial and error method, with things like CompiledBase.get("skinDirectory"), is failing me.
davidekholm

Posts: 3,442
Registered: 18-Oct-2002
Re: Getting skinDirectory from a customUI
Posted: 11 Jan 16, 17:42   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
You can write:
Config.getConfig().chainedSkinsDir.getFile(context.getEngine().getSkin());
This will give you the File reference to the currently selected skin, no matter if it's bundled or installed thereafter.

Edited by: davidekholm on 11-Jan-2016 18:34
Changed engine to getEngine()
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Getting skinDirectory from a customUI
Posted: 11 Jan 16, 17:54   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Now NetBeans is telling me that engine has private access in jAlbumContext.
davidekholm

Posts: 3,442
Registered: 18-Oct-2002
Re: Getting skinDirectory from a customUI
Posted: 11 Jan 16, 18:35   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
jGromit wrote:
Now NetBeans is telling me that engine has private access in jAlbumContext.

Sorry, see updated example above
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Getting skinDirectory from a customUI
Posted: 11 Jan 16, 18:46   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Yes, that's much better. Compiles, and behaves as expected. :)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums