Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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)
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)
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" }}