home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (TableLayoutDemo.groovy)

This example Groovy source code file (TableLayoutDemo.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

about, awt, demo, demo, gui, html, html, swing, swing, swingbuilder, tablelayout, tablelayout, tablelayoutdemo

The Groovy TableLayoutDemo.groovy source code

package groovy.swing

import java.awt.BorderLayout
import javax.swing.BorderFactory

/**
 * Demonstrates the use of the table layout
 */
class TableLayoutDemo {
    
    def frame
    def swing
    
    void run() {
        swing = new SwingBuilder()
        
        frame = swing.frame(title:'TableLayout Demo', location:[200,200], size:[300,200]) {
            menuBar {
                menu(text:'Help') {
                    menuItem() {
                        action(name:'About', closure:{ showAbout() })
                    }
                }
            }
            tableLayout {
                tr {
                    td {
                        label(text:'name')
                    }
                    td(colfill:true) {
                        textField(text:'James')
                    }
                }
                tr {
                    td {
                        label(text:'location')
                    }
                    td(colfill:true) {
                        textField(text:'London')
                    }
                }
                tr {
                    td(colspan:2, align:'center') {
                        button(text:'OK')
                    }
                }
            }
        }
        frame.show()
    }
    
    void showAbout() {
         def pane = swing.optionPane(message:'This demo shows how you can use HTML style table layouts with Swing components')
         def dialog = pane.createDialog(frame, 'About TableLayout Demo')
         dialog.show()
    }
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy TableLayoutDemo.groovy source code file:

new blog posts

 

Copyright 1998-2013 Alvin Alexander, alvinalexander.com
All Rights Reserved.