Hi Peter,

This is definitely possible. The implementation specifics will depend largely 
on what you are trying to accomplish. Extending an existing class is probably 
the easiest way to create a custom component. This example shows how to create 
a custom subclass of Pivot's Window component that implements the code behind 
for the markup defined in java_window.bxml:

  
http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java
  
http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml

However, you can also subclass Component directly - in that case, you'll also 
need to provide at least one skin class for your custom component. Here's a 
simple example that implements the "ruler" headers in the ScrollPane tutorial:

  
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Ruler.java
  
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerListener.java
  
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java

Hope this helps,
Greg

On Sep 30, 2010, at 9:43 AM, Piotr Rojek wrote:

> 
> 
> Hello
> 
> I need to create sth like a custom control in Pivot. I would like to define 
> layout in XML and have a Java code-behind file. Basically I want to 
> dynamically load and then unload this control as needed in main window but 
> all the but all the behavior should be defined in code-behind file, not in 
> application. Is it possible and how to code it?
> 
> Cheers,
> 
> Peter
> 
> 
> 
> 
> 
> 

Reply via email to