use of javax.swing.event.InternalFrameListener in project jdk8u_jdk by JetBrains.
the class JInternalFrame method fireInternalFrameEvent.
// remind: name ok? all one method ok? need to be synchronized?
/**
* Fires an internal frame event.
*
* @param id the type of the event being fired; one of the following:
* <ul>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_OPENED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_CLOSING</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_CLOSED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_ICONIFIED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_ACTIVATED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED</code>
* </ul>
* If the event type is not one of the above, nothing happens.
*/
protected void fireInternalFrameEvent(int id) {
Object[] listeners = listenerList.getListenerList();
InternalFrameEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == InternalFrameListener.class) {
if (e == null) {
e = new InternalFrameEvent(this, id);
// System.out.println("InternalFrameEvent: " + e.paramString());
}
switch(e.getID()) {
case InternalFrameEvent.INTERNAL_FRAME_OPENED:
((InternalFrameListener) listeners[i + 1]).internalFrameOpened(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
((InternalFrameListener) listeners[i + 1]).internalFrameClosing(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
((InternalFrameListener) listeners[i + 1]).internalFrameClosed(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
((InternalFrameListener) listeners[i + 1]).internalFrameIconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
((InternalFrameListener) listeners[i + 1]).internalFrameDeiconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
((InternalFrameListener) listeners[i + 1]).internalFrameActivated(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
((InternalFrameListener) listeners[i + 1]).internalFrameDeactivated(e);
break;
default:
break;
}
}
}
/* we could do it off the event, but at the moment, that's not how
I'm implementing it */
// if (id == InternalFrameEvent.INTERNAL_FRAME_CLOSING) {
// doDefaultCloseAction();
// }
}
use of javax.swing.event.InternalFrameListener in project drools by kiegroup.
the class AdventureFrame method handleRequestGive.
// public void receiveMessage(List cmd) {
// Performative p = null;
//
// switch ( p ) {
// case REQUEST :
// //Performatives r = ( Performatives ) p ;
// }
// }
public void handleRequestGive() {
final JOptionPane pane = new JOptionPane("xxx msg");
pane.setWantsInput(true);
pane.setInputValue("");
pane.setOptions(new String[] { "Yes", "No" });
JInternalFrame internalFrame = pane.createInternalFrame(contentPane, "xxx title");
internalFrame.setVisible(true);
pane.show();
internalFrame.addInternalFrameListener(new InternalFrameListener() {
public void internalFrameOpened(InternalFrameEvent e) {
}
public void internalFrameIconified(InternalFrameEvent e) {
}
public void internalFrameDeiconified(InternalFrameEvent e) {
}
public void internalFrameDeactivated(InternalFrameEvent e) {
}
public void internalFrameClosing(InternalFrameEvent e) {
}
public void internalFrameClosed(InternalFrameEvent e) {
System.out.println(pane.getInputValue() + ":" + pane.getValue());
}
public void internalFrameActivated(InternalFrameEvent e) {
}
});
}
Aggregations