Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-303

import using package.* doesn't seem to work properly for implements/extends class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-5
    • None
    • None

    Description

      This doesn't work unless you fully qualify the interface...

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

      class Scholastic implements java.awt.event.ActionListener {
      static void main(args)

      { scholastic = new Scholastic() scholastic.createUI() }

      void createUI()

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

      void actionPerformed(event)

      { print "hello" }

      }

      But this works...

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

      class Scholastic implements ActionListener {
      static void main(args)

      { scholastic = new Scholastic() scholastic.createUI() }

      void createUI()

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

      public void actionPerformed(ActionEvent event)

      { println "hello" }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: