1. /*
  2. * @(#)InternalFrameEvent.java 1.8 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.event;
  8. import java.awt.AWTEvent;
  9. import javax.swing.JInternalFrame;
  10. /**
  11. * InternalFrameEvent: an AWTEvent which adds support for
  12. * JInternalFrame objects as the event source. This class has the
  13. * same event types as WindowEvent, although different ids are used.
  14. * <p>
  15. * <strong>Warning:</strong>
  16. * Serialized objects of this class will not be compatible with
  17. * future Swing releases. The current serialization support is appropriate
  18. * for short term storage or RMI between applications running the same
  19. * version of Swing. A future release of Swing will provide support for
  20. * long term persistence.
  21. *
  22. * @see java.awt.event.WindowEvent
  23. * @see java.awt.event.WindowListener
  24. * @version 1.8 11/29/01
  25. * @author Thomas Ball
  26. */
  27. public class InternalFrameEvent extends AWTEvent {
  28. /**
  29. * The first number in the range of ids used for window events.
  30. */
  31. public static final int INTERNAL_FRAME_FIRST = 25549;
  32. /**
  33. * The last number in the range of ids used for window events.
  34. */
  35. public static final int INTERNAL_FRAME_LAST = 25555;
  36. /**
  37. * The window opened event. This event is delivered only
  38. * the first time a window is made visible.
  39. */
  40. public static final int INTERNAL_FRAME_OPENED = INTERNAL_FRAME_FIRST;
  41. /**
  42. * The "window is closing" event. This event is delivered when
  43. * the user selects "Quit" from the window's system menu. If
  44. * the program does not explicitly hide or destroy the window as
  45. * while processing this event, the window close operation will be
  46. * canceled.
  47. */
  48. public static final int INTERNAL_FRAME_CLOSING = 1 + INTERNAL_FRAME_FIRST;
  49. /**
  50. * The window closed event. This event is delivered after
  51. * the window has been closed as the result of a call to hide or
  52. * destroy.
  53. */
  54. public static final int INTERNAL_FRAME_CLOSED = 2 + INTERNAL_FRAME_FIRST;
  55. /**
  56. * The window iconified event. This event indicates that the window
  57. * was shrunk down to a small icon.
  58. */
  59. public static final int INTERNAL_FRAME_ICONIFIED = 3 + INTERNAL_FRAME_FIRST;
  60. /**
  61. * The window deiconified event type. This event indicates that the
  62. * window has been restored to its normal size.
  63. */
  64. public static final int INTERNAL_FRAME_DEICONIFIED = 4 + INTERNAL_FRAME_FIRST;
  65. /**
  66. * The window activated event type. This event indicates that keystrokes
  67. * and mouse clicks are directed towards this window.
  68. */
  69. public static final int INTERNAL_FRAME_ACTIVATED = 5 + INTERNAL_FRAME_FIRST;
  70. /**
  71. * The window deactivated event type. This event indicates that keystrokes
  72. * and mouse clicks are no longer directed to the window.
  73. */
  74. public static final int INTERNAL_FRAME_DEACTIVATED = 6 + INTERNAL_FRAME_FIRST;
  75. /**
  76. * Constructs a InternalFrameEvent object.
  77. * @param source the JInternalFrame object that originated the event
  78. * @param id an integer indicating the type of event
  79. */
  80. public InternalFrameEvent(JInternalFrame source, int id) {
  81. super(source, id);
  82. }
  83. /**
  84. * Returns a parameter string identifying this event.
  85. * This method is useful for event-logging and for debugging.
  86. *
  87. * @return a string identifying the event and its attributes
  88. */
  89. public String paramString() {
  90. String typeStr;
  91. switch(id) {
  92. case INTERNAL_FRAME_OPENED:
  93. typeStr = "INTERNAL_FRAME_OPENED";
  94. break;
  95. case INTERNAL_FRAME_CLOSING:
  96. typeStr = "INTERNAL_FRAME_CLOSING";
  97. break;
  98. case INTERNAL_FRAME_CLOSED:
  99. typeStr = "INTERNAL_FRAME_CLOSED";
  100. break;
  101. case INTERNAL_FRAME_ICONIFIED:
  102. typeStr = "INTERNAL_FRAME_ICONIFIED";
  103. break;
  104. case INTERNAL_FRAME_DEICONIFIED:
  105. typeStr = "INTERNAL_FRAME_DEICONIFIED";
  106. break;
  107. case INTERNAL_FRAME_ACTIVATED:
  108. typeStr = "INTERNAL_FRAME_ACTIVATED";
  109. break;
  110. case INTERNAL_FRAME_DEACTIVATED:
  111. typeStr = "INTERNAL_FRAME_DEACTIVATED";
  112. break;
  113. default:
  114. typeStr = "unknown type";
  115. }
  116. return typeStr;
  117. }
  118. }