com.ibm.as400.ui.framework.java
Class EventHandler
java.lang.Object
|
+--com.ibm.as400.ui.framework.java.EventHandler
- Direct Known Subclasses:
- MessageCopyButtonHandler
- public abstract class EventHandler
- extends java.lang.Object
The abstract base class for user-defined handler classes which handle events generated
by the UI framework. The base class provides a valid reference to the PanelManager
object for the panel that is generating the events.
Here is an example of what a typical EventHandler
implementation might look like.
In this example the application developer has used the GUI Builder to register a handler
on a pushbutton. When the user clicks on the button the handler is notified
and the application displays a new panel that is modal relative to the original panel.
import com.ibm.as400.ui.framework.java.*;
import java.awt.event.*;
// The event handler implements ActionListener so that
// it can get notified whenever a button is pressed
public class MyButtonHandler extends EventHandler implements ActionListener
{
public MyButtonHandler(PanelManager pm)
{
// Let the base class manage the reference to
// the panel manager for the current panel
super(pm);
}
public void actionPerformed(ActionEvent e)
{
// Create the panel manager for the new panel
PanelManager pm = null;
try { pm = new PanelManager("MyPDML", "MyNewPanel", null); }
catch (DisplayManagerException exc)
{
exc.displayUserMessage(null);
return;
}
// Set the new panel modal relative to the current panel
pm.setModalRelativeTo(panelManager);
// Display the new panel
pm.setVisible(true);
}
}
- Since:
- v4r2m0
- See Also:
PanelManager
Field Summary |
protected PanelManager |
panelManager
The PanelManager instance which is managing the currently active panel. |
Method Summary |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
panelManager
protected PanelManager panelManager
- The
PanelManager
instance which is managing the currently active panel.
This object will be called to handle events generated by this panel.
- See Also:
PanelManager
EventHandler
public EventHandler(PanelManager pm)
- Constructs an
EventHandler
. Subclasses must
override, as follows:
public <handler_class_name>(PanelManager pm) { super(pm); }
- Parameters:
pm
- the PanelManager
for the currently active panel- Since:
- v4r2m0
- See Also:
PanelManager
toString
public java.lang.String toString()
- Returns a string representation of this object.
- Overrides:
toString
in class java.lang.Object
- Returns:
- this object as a string
- Since:
- v4r2m0