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

Groovy example source code file (Groovy303_Bug.groovy)

This example Groovy source code file (Groovy303_Bug.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

a, a, actionlistener, awt, borderlayout, borderlayout, event, groovy303_bug, groovyswingtestcase, gui, hello, jbutton, jframe, jpanel, scholastic, scholastic, swing, world

The Groovy Groovy303_Bug.groovy source code

package groovy.bugs

import java.awt.*
import java.awt.event.*
import javax.swing.*

/**
 * @author Bing Ran
 * @author Andy Dwelly
 * @version $Revision: 13693 $
 */
class Groovy303_Bug extends GroovySwingTestCase {

    void testBug() {
      testInEDT {
        def scholastic = new Scholastic()
        scholastic.createUI()
      }
    }
}

class Scholastic implements ActionListener {

    void createUI() {
        println('createUI called')
        def frame = new JFrame("Hello World")
        def contents = frame.getContentPane()
        def pane = new JPanel()
        pane.setLayout(new BorderLayout())
        def button = new JButton("A button")
        button.addActionListener(this)
        pane.add(button, BorderLayout.CENTER)
        contents.add(pane)
        frame.setSize(100, 100)
        //frame.setVisible(true)
        button.doClick()
    }

    public void actionPerformed(ActionEvent event) {
        println "hello"
    }
}

Other Groovy examples (source code examples)

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

new blog posts

 

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