Last active
December 20, 2015 02:49
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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