Skip to content

Instantly share code, notes, and snippets.

@einnocent
Last active December 20, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save einnocent/a9028c0a058ea59681a3 to your computer and use it in GitHub Desktop.
Save einnocent/a9028c0a058ea59681a3 to your computer and use it in GitHub Desktop.
Example of attempt to reposition a Label element in a StackPane in Apache Pivot 2.0.2
<Window title="Labels" maximized="true" xmlns:bxml="http://pivot.apache.org/bxml"
xmlns="org.apache.pivot.wtk">
<StackPane bxml:id="mainContainer" styles="{backgroundColor:'#cccccc'}">
<!-- sample SVG available at http://upload.wikimedia.org/wikipedia/commons/5/59/Usa_counties_large.svg -->
<ImageView bxml:id="background" image="/Usa_counties_large.svg"
styles="{horizontalAlignment:'left', verticalAlignment:'top', fill:true, preserveAspectRatio:true}" />
<Label bxml:id="countyLabel" text="King County" x="100" y="100"
styles="{font:'Helvetica bold 24', color:'#000000', wrapText:true}" />
</StackPane>
</Window>
import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Window;
public class StackPaneLabelRepositionExample implements Application
{
private Window window = null;
public static void main(String[] args)
{
DesktopApplicationContext.main(StackPaneLabelRepositionExample.class, args);
}
/*****************************************
* Application methods
*****************************************/
@Override
public void startup(Display display, Map<String, String> properties) throws Exception
{
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window) bxmlSerializer.readObject(ZooBacScoreboard.class, "StackPaneLabelRepositionExample.bxml");
window.open(display);
}
@Override
public boolean shutdown(boolean optional)
{
if (window != null)
{
window.close();
}
return false;
}
@Override
public void suspend()
{
}
@Override
public void resume()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment