[forms10g]Javabean et événement
Bonjour à tous,
Contexte :
forms 10g
base oracle 10g
J'ai développé un javabean du style ce n'est évidemment pas celui-ci, mais cela permet de reproduire le problème de manière simple :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import oracle.forms.ui.VBean;
import oracle.forms.ui.CustomEvent;
import oracle.forms.handler.IHandler;
import oracle.forms.properties.ID;
public class TestBouton extends VBean
implements ActionListener
{
public final static ID CLIC_BOUTON = ID.registerProperty("CLIC_BOUTON");
private IHandler m_handler;
private final JFrame frame = new JFrame();
private final JPanel panel = new JPanel();
private final static JButton monBouton = new JButton ("Mon bouton");
public void actionPerformed (ActionEvent e)
{
CustomEvent ce = new CustomEvent (m_handler, CLIC_BOUTON);
dispatchCustomEvent (ce);
}
public TestBouton()
{
monBouton.addActionListener(this);
panel.setLayout (new BorderLayout());
panel.add (monBouton, BorderLayout.NORTH);
frame.setContentPane(panel);
frame.pack();
frame.setVisible(true);
}
public void init (IHandler handler)
{
super.init (handler);
m_handler = handler;
}
public static void main(final String[] args)
throws ParseException
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
TestBouton test = new TestBouton();
}
});
}
} |
Lorsque que je l'exécute et que je clique sur le bouton j'ai l'erreur suivante :
Citation:
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:34)
at oracle.forms.ui.CustomEvent.<init>(Unknown Source)
at TestBouton.actionPerformed(TestBouton.java:27)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Cette erreur concerne la ligne :
Code:
CustomEvent ce = new CustomEvent (m_handler, CLIC_BOUTON);
J'ai du oublier quelque chose, mais je ne vois vraiment pas quoi. Comme c'est le premier javabean que j'ai entièrement développé, j'espère que vous excuserez mon ignorance...