Try just:
public MyTree() {
super();
setSkin(new MyTreeSkin());
}
And then you don't need any theme code in your startup method.
~Roger
-----Original Message-----
From: Josh R [mailto:[email protected]]
Sent: Wednesday, August 08, 2012 3:31 PM
To: [email protected]
Subject: Re: How to block UI input to a disabled/busy TreeNode
On Wed, Aug 8, 2012 at 5:57 PM, Roger L. Whitcomb <[email protected]>
wrote:
>> Can something like this work?
>
> Um, not quite. The skin can only be set once, so you would have to create a
> new component: MyTreeView and a new skin MyTerraTreeViewSkin, and in the
> constructor of the MyTreeView call "setSkin" to your MyTreeViewSkin.
>
public class MyTreeSkin extends TerraTreeViewSkin {
public MyTreeSkin () {
super();
}
public boolean mouseClick(Component component, Mouse.Button button, int
x, int y, int count) {
System.out.println("SKIN comp:"+component.toString());
return super.mouseClick(component, button, x, y, count);
}
}
public class MyTree extends TreeView {
public MyTree() {
super();
installSkin(TreeView.class);
}
}
in startup(display,...) {
this.display = display;
Theme.getTheme().set( TreeView.class, MyTreeSkin.class); .....
}
I'm getting an exception:
java.lang.IllegalArgumentException: java.lang.InstantiationException:
com.foobar.proto.main_proto$MyTreeSkin
at org.apache.pivot.wtk.Component.installSkin(Component.java:834)
at org.apache.pivot.wtk.TreeView.<init>(TreeView.java:924)
at org.apache.pivot.wtk.TreeView.<init>(TreeView.java:908)
at com.foobar.proto.main_proto$MyTree.<init>(main_proto.java:86)
at com.foobar.proto.main_proto.create_hosts_tree(main_proto.java:662)
at com.foobar.proto.main_proto.startup(main_proto.java:834)
And:
public void create_hosts_tree() {
my_tree = new MyTree();
...
}
thanks