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