Svcc Java2D And Groovy

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Svcc Java2D And Groovy - Presentation Transcript

    1. Java2D and G r oo v y , a Perfect Match Andres Almiray
    2. Agenda
      • What is G r oo v y?
      • SwingBuilder
      • GraphicsBuilder
      • Putting it all together
      • What’s next?
    3. W hat is G r oo v y ?
    4. SwingBuilder
    5. Builder Basics
      • Builders are a form of a DSL
      • Focused on Hierarchical Structures
      • SwingBuilder is not the only Builder in G r oo v y
        • XMLBuilder
        • AntBuilder
        • ObjectGraphBuilder
        • Still Others…
      • Swing applications follow a hierarchical model:
        • Window
        • Panel
        • Button
      • Builders are a perfect fit for making Swing UIs
    6. A Quick HelloWorld Example
      • groovy.swing.SwingBuilder.build {
      • frame( id: 'root', title:'Hello World',
      • show:true, pack:true) {
      • flowLayout()‏
      • label('Enter a message:')‏
      • textField(id:'name', columns:20)‏
      • button('Click',
      • actionPerformed: { ActionEvent e ->
      • if (name.text)‏
      • optionPane().showMessageDialog(
      • root, name.text)‏
      • })‏
      • }
      • }
    7. What's going on?
      • Each node is syntactically a method call
      • All of these method calls are dynamically dispatched
        • Most don’t actually exist in bytecode
      • Child closures create hierarchical relations
        • Child widgets are added to parent containers
      • SwingBuilder node names are derived from Swing classes
        • Remove the leading ‘J’ from a Swing class when present
      • SwingBuilder also supports some AWT classes like layouts
    8. GraphicsBuilder
    9. GraphicsBuilder - Basics
      • GraphicsBuilder is to Java2D what SwingBuilder is to Swing
      • It produces a hierarchy of GraphicsOperations (or nodes)‏
      • A specialized component is required to render graphicsOperations and handle input events: GraphicsPanel
    10. GraphicsBuilder - Features
      • shapes - shape, outline, areas
        • regular Java2D shapes from java.wt.geom
        • additional shapes from jSilhouette
      • paints - solid, gradients, composite
      • strokes - from jhlabs
      • filters - from swingx, jhlabs
      • grouping, transfortmations , images
      • svg - import/export via Batik
      • swf - partial export (still experimental)‏
    11. GraphicsPad
    12. Putting it all together
    13. Mixing Swing & Graphics
      • Use SwingBuilder to build the UI
      • Use GraphicsBuilder to draw anywhere you need
        • in a GraphicsPanel
        • in JLayeredPane
        • in SwingX layered components
        • in Jide’s overlay support
    14. Tips & Hints
      • Use SwingBuilder.build()‏
      • Use Expando for quick prototyping of beans
      • Use ObservableMap for quick binding tests
      • Reuse shapes as must as you can
      • Group operations that may have the same settings applied (color, borderWidth, fill, transformations)‏
    15. What’s next?
    16. Tips & Hints
      • Custom nodes
      • Custom painting of Swing components
      • Animation support
    17. Resources
      • h tt p : // groovy.codehaus.org
      • h tt p : // groovy.codehaus.org/Swing+Builder
      • h tt p : // groovy.codehaus.org/SwingXBuilder
      • h tt p : // groovy.codehaus.org/JideBuilder
      • h tt p : // groovy.codehaus.org/GraphicsBuilder
      • h tt p : // code.google.com/p/jsilhouette
      • h tt p : // jroller.com/aalmiray
      • h tt p : // twitter.com/aalmiray
    18. Q & A
    19. Thank you!

    + Andres AlmirayAndres Almiray, 2 years ago

    custom

    673 views, 0 favs, 1 embeds more stats

    Java2D and Groovy, a Perfect Match

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 673
      • 666 on SlideShare
      • 7 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 11
    Most viewed embeds
    • 7 views on http://codecamp.pbwiki.com

    more

    All embeds
    • 7 views on http://codecamp.pbwiki.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories