1 /* SwingComponentPeer.java -- An abstract base class for Swing based peers
2 Copyright (C) 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package gnu
.java
.awt
.peer
.swing
;
40 import java
.awt
.AWTEvent
;
41 import java
.awt
.AWTException
;
42 import java
.awt
.BufferCapabilities
;
43 import java
.awt
.Color
;
44 import java
.awt
.Component
;
45 import java
.awt
.Cursor
;
46 import java
.awt
.Dimension
;
48 import java
.awt
.FontMetrics
;
49 import java
.awt
.Graphics
;
50 import java
.awt
.GraphicsConfiguration
;
51 import java
.awt
.Image
;
52 import java
.awt
.Point
;
53 import java
.awt
.Rectangle
;
54 import java
.awt
.Toolkit
;
55 import java
.awt
.BufferCapabilities
.FlipContents
;
56 import java
.awt
.event
.KeyEvent
;
57 import java
.awt
.event
.MouseEvent
;
58 import java
.awt
.event
.PaintEvent
;
59 import java
.awt
.image
.ColorModel
;
60 import java
.awt
.image
.ImageObserver
;
61 import java
.awt
.image
.ImageProducer
;
62 import java
.awt
.image
.VolatileImage
;
63 import java
.awt
.peer
.ComponentPeer
;
64 import java
.awt
.peer
.ContainerPeer
;
67 * The base class for Swing based component peers. This provides the basic
68 * functionality needed for Swing based component peers. Many methods are
69 * implemented to forward to the Swing component. Others however forward
70 * to the component's parent and expect the toplevel component peer to provide
71 * a real implementation of it. These are for example the key methods
72 * {@link #getGraphics()} and {@link #createImage(int, int)}, as well as
73 * {@link #getLocationOnScreen()}.
75 * This class also provides the necesary hooks into the Swing painting and
76 * event handling system. In order to achieve this, it traps paint, mouse and
77 * key events in {@link #handleEvent(AWTEvent)} and calls some special methods
78 * ({@link #peerPaint(Graphics)}, {@link #handleKeyEvent(KeyEvent)},
79 * {@link #handleMouseEvent(MouseEvent)} and
80 * {@link #handleMouseMotionEvent(MouseEvent)}) that call the corresponding
83 * @author Roman Kennke (kennke@aicas.com)
85 public class SwingComponentPeer
86 implements ComponentPeer
90 * The AWT component for this peer.
92 protected Component awtComponent
;
95 * The Swing component for this peer.
97 protected SwingComponent swingComponent
;
100 * Creates a SwingComponentPeer instance. Subclasses are expected to call
101 * this constructor and thereafter call {@link #init(Component, JComponent)}
102 * in order to setup the AWT and Swing components properly.
104 protected SwingComponentPeer()
106 // Nothing to do here.
110 * Initializes the AWT and Swing component for this peer. It is expected that
111 * subclasses call this from within their constructor.
113 * @param awtComp the AWT component for this peer
114 * @param swingComp the Swing component for this peer
116 protected void init(Component awtComp
, SwingComponent swingComp
)
118 awtComponent
= awtComp
;
119 swingComponent
= swingComp
;
123 * Returns the construction status of the specified image. This is called
124 * by {@link Component#checkImage(Image, int, int, ImageObserver)}.
126 * @param img the image
127 * @param width the width of the image
128 * @param height the height of the image
129 * @param ob the image observer to be notified of updates of the status
131 * @return a bitwise ORed set of ImageObserver flags
133 public int checkImage(Image img
, int width
, int height
, ImageObserver ob
)
135 return Toolkit
.getDefaultToolkit().checkImage(img
, width
, height
, ob
);
139 * Creates an image by starting the specified image producer. This is called
140 * by {@link Component#createImage(ImageProducer)}.
142 * @param prod the image producer to be used to create the image
144 * @return the created image
146 public Image
createImage(ImageProducer prod
)
148 Image image
= Toolkit
.getDefaultToolkit().createImage(prod
);
153 * Creates an empty image with the specified <code>width</code> and
154 * <code>height</code>.
156 * This is implemented to let the parent component create the image. This
157 * eventually goes up to the top-level component peer, which is then expected
158 * to deliver the image.
160 * @param width the width of the image to be created
161 * @param height the height of the image to be created
163 * @return the created image
165 public Image
createImage(int width
, int height
)
167 Component parent
= awtComponent
.getParent();
168 ComponentPeer parentPeer
= parent
.getPeer();
169 return parentPeer
.createImage(width
, height
);
173 * Disables the component. This is called by {@link Component#disable()}.
175 public void disable()
177 if (swingComponent
!= null)
178 swingComponent
.getJComponent().setEnabled(false);
182 * Disposes the component peer. This should release all resources held by the
183 * peer. This is called when the component is no longer in use.
185 public void dispose()
188 swingComponent
= null;
192 * Enables the component. This is called by {@link Component#enable()}.
196 if (swingComponent
!= null)
197 swingComponent
.getJComponent().setEnabled(true);
201 * Returns the color model of the component. This is currently not used.
203 * @return the color model of the component
205 public ColorModel
getColorModel()
207 // FIXME: When this peer method will be used, we need to provide an
208 // implementation of this, probably forwarding to the toplevel peer, like
209 // in the other methods.
214 * Returns the font metrics for the specified font. This is called by
215 * {@link Component#getFontMetrics(Font)}.
217 * This is implemented to query the font metrics from the parent component.
218 * This will eventually call the top-level component peer, which is then
219 * expected to deliver a font metrics object.
221 * @param f the font for which to query the font metrics
223 * @return the font metrics for the specified font
225 public FontMetrics
getFontMetrics(Font f
)
227 Component parent
= awtComponent
.getParent();
228 ComponentPeer parentPeer
= parent
.getPeer();
229 return parentPeer
.getFontMetrics(f
);
233 * Returns a {@link Graphics} object suitable for drawing on this component.
234 * This is called by {@link Component#getGraphics()}.
236 * This is implemented to query the graphics from the parent component and
237 * adjust the clip and translation to match this component.
238 * This will eventually call the top-level component peer, which is then
239 * expected to deliver a graphics object.
241 * @return a graphics object suitable for drawing on this component
243 public Graphics
getGraphics()
245 Component parent
= awtComponent
.getParent();
246 ComponentPeer parentPeer
= parent
.getPeer();
247 Graphics g
= parentPeer
.getGraphics();
248 g
.translate(awtComponent
.getX(), awtComponent
.getY());
249 g
.setClip(0, 0, awtComponent
.getWidth(), awtComponent
.getHeight());
254 * Returns the location of this component in screen coordinates. This is
255 * called by {@link Component#getLocationOnScreen()}.
257 * This is implemented to query the parent component peer for its screen
258 * location and adds the offset of this component to it. This will eventually
259 * call the top-level component's peer, which is then expected to provide
260 * it's screen location.
262 * @return the location of this component in screen coordinates
264 public Point
getLocationOnScreen()
266 Component parent
= awtComponent
.getParent();
267 ComponentPeer parentPeer
= parent
.getPeer();
268 Point location
= parentPeer
.getLocationOnScreen();
269 location
.x
+= awtComponent
.getX();
270 location
.y
+= awtComponent
.getY();
275 * Returns the minimum size for the component. This is called by
276 * {@link Component#getMinimumSize()}.
278 * This is implemented to return the Swing component's minimum size.
280 * @return the minimum size for the component
282 public Dimension
getMinimumSize()
285 if (swingComponent
!= null)
286 retVal
= swingComponent
.getJComponent().getMinimumSize();
288 retVal
= new Dimension(0, 0);
293 * Returns the preferred size for the component. This is called by
294 * {@link Component#getPreferredSize()}.
296 * This is implemented to return the Swing component's preferred size.
298 * @return the preferred size for the component
300 public Dimension
getPreferredSize()
303 if (swingComponent
!= null)
304 retVal
= swingComponent
.getJComponent().getPreferredSize();
306 retVal
= new Dimension(0, 0);
311 * Returns the toolkit that created this peer.
313 * @return the toolkit that created this peer
315 public Toolkit
getToolkit()
317 return Toolkit
.getDefaultToolkit();
321 * Handles the given event. This is called from
322 * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to
323 * react to events for the component.
327 public void handleEvent(AWTEvent e
)
331 case PaintEvent
.UPDATE
:
332 case PaintEvent
.PAINT
:
333 Graphics g
= getGraphics();
334 Rectangle clip
= ((PaintEvent
)e
).getUpdateRect();
335 g
.clipRect(clip
.x
, clip
.y
, clip
.width
, clip
.height
);
336 //if (this instanceof LightweightPeer)
338 if (e
.getID() == PaintEvent
.UPDATE
)
339 awtComponent
.update(g
);
341 awtComponent
.paint(g
);
343 // We paint the 'heavyweights' at last, so that they appear on top of
349 case MouseEvent
.MOUSE_PRESSED
:
350 case MouseEvent
.MOUSE_RELEASED
:
351 case MouseEvent
.MOUSE_CLICKED
:
352 case MouseEvent
.MOUSE_ENTERED
:
353 case MouseEvent
.MOUSE_EXITED
:
354 handleMouseEvent((MouseEvent
) e
);
356 case MouseEvent
.MOUSE_MOVED
:
357 case MouseEvent
.MOUSE_DRAGGED
:
358 handleMouseMotionEvent((MouseEvent
) e
);
360 case KeyEvent
.KEY_PRESSED
:
361 case KeyEvent
.KEY_RELEASED
:
362 case KeyEvent
.KEY_TYPED
:
363 handleKeyEvent((KeyEvent
) e
);
366 // Other event types are not handled here.
372 * Makes the component invisible. This is called from
373 * {@link Component#hide()}.
375 * This is implemented to call setVisible(false) on the Swing component.
379 if (swingComponent
!= null)
380 swingComponent
.getJComponent().setVisible(false);
384 * Returns <code>true</code> if the component can receive keyboard input
385 * focus. This is called from {@link Component#isFocusTraversable()}.
387 * This is implemented to return isFocusable() from the Swing component.
389 * @specnote Part of the earlier 1.1 API, replaced by isFocusable().
391 public boolean isFocusTraversable()
393 return swingComponent
!= null ?
394 swingComponent
.getJComponent().isFocusable() : false;
398 * Returns <code>true</code> if the component can receive keyboard input
399 * focus. This is called from {@link Component#isFocusable()}.
401 * This is implemented to return isFocusable() from the Swing component.
403 public boolean isFocusable()
405 return swingComponent
!= null ?
406 swingComponent
.getJComponent().isFocusable() : false;
410 * Returns the minimum size for the component. This is called by
411 * {@link Component#minimumSize()}.
413 * This is implemented to return the Swing component's minimum size.
415 * @return the minimum size for the component
417 public Dimension
minimumSize()
420 if (swingComponent
!= null)
421 retVal
= swingComponent
.getJComponent().getMinimumSize();
423 retVal
= new Dimension(0, 0);
428 * Returns the preferred size for the component. This is called by
429 * {@link Component#getPreferredSize()}.
431 * This is implemented to return the Swing component's preferred size.
433 * @return the preferred size for the component
435 public Dimension
preferredSize()
438 if (swingComponent
!= null)
439 retVal
= swingComponent
.getJComponent().getPreferredSize();
441 retVal
= new Dimension(0, 0);
446 * Prepares an image for rendering on this component. This is called by
447 * {@link Component#prepareImage(Image, int, int, ImageObserver)}.
449 * @param img the image to prepare
450 * @param width the desired width of the rendered image
451 * @param height the desired height of the rendered image
452 * @param ob the image observer to be notified of updates in the preparation
455 * @return <code>true</code> if the image has been fully prepared,
456 * <code>false</code> otherwise (in which case the image observer
459 public void paint(Graphics graphics
)
461 // FIXME: I don't know what this method is supposed to do.
465 * Prepares an image for rendering on this component. This is called by
466 * {@link Component#prepareImage(Image, int, int, ImageObserver)}.
468 * @param img the image to prepare
469 * @param width the desired width of the rendered image
470 * @param height the desired height of the rendered image
471 * @param ob the image observer to be notified of updates in the preparation
474 * @return <code>true</code> if the image has been fully prepared,
475 * <code>false</code> otherwise (in which case the image observer
478 public boolean prepareImage(Image img
, int width
, int height
, ImageObserver ob
)
480 Component parent
= awtComponent
.getParent();
481 ComponentPeer parentPeer
= parent
.getPeer();
482 return parentPeer
.prepareImage(img
, width
, height
, ob
);
485 public void print(Graphics graphics
)
487 // FIXME: I don't know what this method is supposed to do.
491 * Repaints the specified rectangle of this component. This is called from
492 * {@link Component#repaint(long, int, int, int, int)}.
494 * This is implemented to call repaint() on the Swing component.
496 * @param tm number of milliseconds to wait with repainting
497 * @param x the X coordinate of the upper left corner of the damaged rectangle
498 * @param y the Y coordinate of the upper left corner of the damaged rectangle
499 * @param width the width of the damaged rectangle
500 * @param height the height of the damaged rectangle
502 public void repaint(long tm
, int x
, int y
, int width
, int height
)
504 if (swingComponent
!= null)
505 swingComponent
.getJComponent().repaint(tm
, x
, y
, width
, height
);
508 PaintEvent ev
= new PaintEvent(awtComponent
, PaintEvent
.UPDATE
,
509 new Rectangle(x
, y
, width
, height
));
510 Toolkit
.getDefaultToolkit().getSystemEventQueue().postEvent(ev
);
515 * Requests that this component receives the focus. This is called from
516 * {@link Component#requestFocus()}.
518 * This calls requestFocus() on the Swing component.
520 * @specnote Part of the earlier 1.1 API, apparently replaced by argument
521 * form of the same method.
523 public void requestFocus()
525 if (swingComponent
!= null)
526 swingComponent
.getJComponent().requestFocus();
530 * Requests that this component receives the focus. This is called from
531 * {@link Component#requestFocus()}.
533 * This calls requestFocus() on the Swing component.
542 public boolean requestFocus(Component source
, boolean bool1
, boolean bool2
, long x
)
544 if (swingComponent
!= null)
545 swingComponent
.getJComponent().requestFocus();
546 return swingComponent
!= null;
550 * Notifies the peer that the bounds of this component have changed. This
551 * is called by {@link Component#reshape(int, int, int, int)}.
553 * This is implemented to call setBounds() on the Swing component.
555 * @param x the X coordinate of the upper left corner of the component
556 * @param y the Y coordinate of the upper left corner of the component
557 * @param width the width of the component
558 * @param height the height of the component
560 public void reshape(int x
, int y
, int width
, int height
)
562 if (swingComponent
!= null)
563 swingComponent
.getJComponent().setBounds(x
, y
, width
, height
);
567 * Sets the background color of the component. This is called by
568 * {@link Component#setBackground(Color)}.
570 * This is implemented to call setBackground() on the Swing component.
572 * @param color the background color to set
574 public void setBackground(Color color
)
576 if (swingComponent
!= null)
577 swingComponent
.getJComponent().setBackground(color
);
581 * Notifies the peer that the bounds of this component have changed. This
582 * is called by {@link Component#setBounds(int, int, int, int)}.
584 * This is implemented to call setBounds() on the Swing component.
586 * @param x the X coordinate of the upper left corner of the component
587 * @param y the Y coordinate of the upper left corner of the component
588 * @param width the width of the component
589 * @param height the height of the component
591 public void setBounds(int x
, int y
, int width
, int height
)
593 if (swingComponent
!= null)
594 swingComponent
.getJComponent().setBounds(x
, y
, width
, height
);
598 * Sets the cursor of the component. This is called by
599 * {@link Component#setCursor(Cursor)}.
601 * This is implemented to call setCursor() on the Swing component.
603 * @specnote Part of the earlier 1.1 API, apparently no longer needed.
605 public void setCursor(Cursor cursor
)
607 if (swingComponent
!= null)
608 swingComponent
.getJComponent().setCursor(cursor
);
612 * Sets the enabled/disabled state of this component. This is called by
613 * {@link Component#setEnabled(boolean)}.
615 * This is implemented to call setEnabled() on the Swing component.
617 * @param enabled <code>true</code> to enable the component,
618 * <code>false</code> to disable it
620 public void setEnabled(boolean enabled
)
622 if (swingComponent
!= null)
623 swingComponent
.getJComponent().setEnabled(enabled
);
627 * Sets the font of the component. This is called by
628 * {@link Component#setFont(Font)}.
630 * This is implemented to call setFont() on the Swing component.
632 * @param font the font to set
634 public void setFont(Font font
)
636 if (swingComponent
!= null)
637 swingComponent
.getJComponent().setFont(font
);
641 * Sets the foreground color of the component. This is called by
642 * {@link Component#setForeground(Color)}.
644 * This is implemented to call setForeground() on the Swing component.
646 * @param color the foreground color to set
648 public void setForeground(Color color
)
650 if (swingComponent
!= null)
651 swingComponent
.getJComponent().setForeground(color
);
655 * Sets the visibility state of the component. This is called by
656 * {@link Component#setVisible(boolean)}.
658 * This is implemented to call setVisible() on the Swing component.
660 * @param visible <code>true</code> to make the component visible,
661 * <code>false</code> to make it invisible
663 public void setVisible(boolean visible
)
665 if (swingComponent
!= null)
666 swingComponent
.getJComponent().setVisible(visible
);
670 * Makes the component visible. This is called by {@link Component#show()}.
672 * This is implemented to call setVisible(true) on the Swing component.
676 if (swingComponent
!= null)
677 swingComponent
.getJComponent().setVisible(true);
681 * Get the graphics configuration of the component. The color model
682 * of the component can be derived from the configuration.
684 * This is implemented to return the GraphicsConfiguration of the parent
685 * component. This will eventually call the toplevel component peer, which
686 * is expected to provide a real implementation.
688 * @return the graphics configuration of the component
690 public GraphicsConfiguration
getGraphicsConfiguration()
692 Component parent
= awtComponent
.getParent();
693 ComponentPeer parentPeer
= parent
.getPeer();
694 return parentPeer
.getGraphicsConfiguration();
698 * Part of an older API, no longer needed.
700 public void setEventMask(long mask
)
702 // Nothing to do here.
706 * Returns <code>true</code> if this component has been obscured,
707 * <code>false</code> otherwise. This will only work if
708 * {@link #canDetermineObscurity()} also returns <code>true</code>.
710 * This is not yet implemented.
712 * @return <code>true</code> if this component has been obscured,
713 * <code>false</code> otherwise.
715 public boolean isObscured()
721 * Returns <code>true</code> if this component peer can determine if the
722 * component has been obscured, <code>false</code> otherwise.
724 * This is not yet implemented.
726 * @return <code>true</code> if this component peer can determine if the
727 * component has been obscured, <code>false</code> otherwise
729 public boolean canDetermineObscurity()
735 * Coalesces the specified paint event.
737 * @param e the paint event
739 public void coalescePaintEvent(PaintEvent e
)
741 // Nothing to do here yet.
745 * Updates the cursor. This is not yet implemented.
747 public void updateCursorImmediately()
749 // Nothing to do here yet.
753 * Returns true, if this component can handle wheel scrolling,
754 * <code>false</code> otherwise.
756 * This is not yet implemented and returns <code>false</code>.
758 * @return true, if this component can handle wheel scrolling,
759 * <code>false</code> otherwise
761 public boolean handlesWheelScrolling()
767 * A convenience method that creates a volatile image. The volatile
768 * image is created on the screen device on which this component is
769 * displayed, in the device's current graphics configuration.
771 * This is implemented to let the parent component peer create an image.
772 * This eventually ends up in the toplevel component peer, which is then
773 * responsible for creating the real image.
775 * @param width width of the image
776 * @param height height of the image
782 public VolatileImage
createVolatileImage(int width
, int height
)
784 Component parent
= awtComponent
.getParent();
785 ComponentPeer parentPeer
= parent
.getPeer();
786 return parentPeer
.createVolatileImage(width
, height
);
790 * Create a number of image buffers that implement a buffering
791 * strategy according to the given capabilities.
793 * This is implemented to forward to the parent component peer. Eventually
794 * this ends up in the top level component peer, which is then responsible
795 * for doing the real work.
797 * @param numBuffers the number of buffers
798 * @param caps the buffering capabilities
800 * @throws AWTException if the specified buffering strategy is not
805 public void createBuffers(int numBuffers
, BufferCapabilities caps
) throws AWTException
807 Component parent
= awtComponent
.getParent();
808 ComponentPeer parentPeer
= parent
.getPeer();
809 parentPeer
.createBuffers(numBuffers
, caps
);
813 * Return the back buffer of this component.
815 * This is implemented to forward to the parent. Eventually this ends
816 * up in the toplevel component, which is then responsible for providing
819 * @return the back buffer of this component.
823 public Image
getBackBuffer()
825 Component parent
= awtComponent
.getParent();
826 ComponentPeer parentPeer
= parent
.getPeer();
827 return parentPeer
.getBackBuffer();
831 * Perform a page flip, leaving the contents of the back buffer in
832 * the specified state.
834 * This is implemented to forward to the parent. Eventually this ends
835 * up in the toplevel component, which is then responsible for doing the real
838 * @param contents the state in which to leave the back buffer
842 public void flip(FlipContents contents
)
844 Component parent
= awtComponent
.getParent();
845 ComponentPeer parentPeer
= parent
.getPeer();
846 parentPeer
.flip(contents
);
850 * Destroy the resources created by createBuffers.
852 * This is implemented to forward to the parent component peer. Eventually
853 * this ends up in the top level component peer, which is then responsible
854 * for doing the real work.
858 public void destroyBuffers()
860 Component parent
= awtComponent
.getParent();
861 ComponentPeer parentPeer
= parent
.getPeer();
862 parentPeer
.destroyBuffers();
866 * Get the bounds of this component peer.
868 * This is implemented to forward to the Swing component.
870 * @return component peer bounds
873 public Rectangle
getBounds()
876 if (swingComponent
!= null)
877 retVal
= swingComponent
.getJComponent().getBounds();
879 retVal
= new Rectangle();
884 * Reparent this component under another container.
889 public void reparent(ContainerPeer parent
)
891 // Nothing to do here.
895 * Set the bounds of this component peer.
897 * This is implemented to forward to the swing component.
899 * @param x the new x co-ordinate
900 * @param y the new y co-ordinate
901 * @param width the new width
902 * @param height the new height
903 * @param z the new stacking level
906 public void setBounds(int x
, int y
, int width
, int height
, int z
)
908 if (swingComponent
!= null)
909 swingComponent
.getJComponent().setBounds(x
, y
, width
, height
);
910 // FIXME: Somehow handle the Z order.
914 * Check if this component supports being reparented.
916 * @return true if this component can be reparented,
920 public boolean isReparentSupported()
927 * Layout this component peer.
933 if (swingComponent
!= null)
934 swingComponent
.getJComponent().doLayout();
938 * Triggers 'heavyweight' painting of the components. This usually calls
939 * paint() on the Swing component.
941 * @param g the graphics context to use for painting
943 protected void peerPaint(Graphics g
)
945 if (swingComponent
!= null)
946 swingComponent
.getJComponent().paint(g
);
950 * Handles mouse events on the component. This is usually forwarded to the
951 * SwingComponent's processMouseEvent() method.
953 * @param e the mouse event
955 protected void handleMouseEvent(MouseEvent e
)
957 if (swingComponent
!= null)
958 swingComponent
.handleMouseEvent(e
);
962 * Handles mouse motion events on the component. This is usually forwarded
963 * to the SwingComponent's processMouseMotionEvent() method.
965 * @param e the mouse motion event
967 protected void handleMouseMotionEvent(MouseEvent e
)
969 if (swingComponent
!= null)
970 swingComponent
.handleMouseMotionEvent(e
);
974 * Handles key events on the component. This is usually forwarded to the
975 * SwingComponent's processKeyEvent() method.
977 * @param e the key event
979 protected void handleKeyEvent(KeyEvent e
)
981 if (swingComponent
!= null)
982 swingComponent
.handleKeyEvent(e
);
986 * Returns the AWT component for this peer.
988 * @return the AWT component for this peer
990 public Component
getComponent()