Status: New Owner: ---- New issue 150 by samrreid: Prepare SwingLayoutNode for distribution http://code.google.com/p/piccolo2d/issues/detail?id=150
My colleagues and I also saw a need for a Swing-like layout solution for Piccolo2D, so we wrote an adapter that actually uses a swing layout manager to arrange Piccolo nodes. I've attached the entire implementation and example usage in SwingLayoutNode.java. Let's discuss whether this should be included in the upcoming Piccolo 1.3 release. Sample using Swing's FlowLayout: SwingLayoutNode flowLayoutNode = new SwingLayoutNode( new FlowLayout() ); flowLayoutNode.addChild( new PText( "1+1" ) ); flowLayoutNode.addChild( new PText( "2+2" ) ); Sample using Swing's BorderLayout: BorderLayout borderLayout = new BorderLayout(); borderLayout.setHgap( 10 ); borderLayout.setVgap( 5 ); SwingLayoutNode borderLayoutNode = new SwingLayoutNode( borderLayout ); borderLayoutNode.addChild( new PText( "North" ), BorderLayout.NORTH ); borderLayoutNode.setAnchor( Anchor.CENTER ); borderLayoutNode.addChild( new PText( "South" ), BorderLayout.SOUTH ); borderLayoutNode.setAnchor( Anchor.WEST ); borderLayoutNode.addChild( new PText( "East" ), BorderLayout.EAST ); borderLayoutNode.addChild( new PText( "West" ), BorderLayout.WEST ); borderLayoutNode.addChild( new PText( "CENTER" ), BorderLayout.CENTER ); I'm also attaching a screenshot of the sample main() for your convenience. Thanks, Sam Reid Attachments: SwingLayoutNode.java 23.1 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en