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


Permlink Replies: 4 - Pages: 1 - Last Post: 11-Jan-2016 18:47 Last Post By: jGromit Threads: [ Previous | Next ]
jGromit

Posts: 32,119
Registered: 31-Jan-2006
Getting skinDirectory from a customUI
Posted: 09-Jan-2016 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: 21,840
Registered: 18-Oct-2002
Re: Getting skinDirectory from a customUI
Posted: 11-Jan-2016 17:42   in response to: jGromit in response to: jGromit
 
  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()
jGromit

Posts: 32,119
Registered: 31-Jan-2006
Re: Getting skinDirectory from a customUI
Posted: 11-Jan-2016 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: 21,840
Registered: 18-Oct-2002
Re: Getting skinDirectory from a customUI
Posted: 11-Jan-2016 18:35   in response to: jGromit in response to: jGromit
 
  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
jGromit

Posts: 32,119
Registered: 31-Jan-2006
Re: Getting skinDirectory from a customUI
Posted: 11-Jan-2016 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. :)

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