Default implementation of mouse drag event?

Is there any Default implementation of mouse drag event?
Say if the developer does not override and implement mouse drag event, still when the frame is dragged, the frame gets repainted itself in the new position. It indicates some default implementation of mouse drag event, but am unable to find out where it has been implemented.
Why bother when everything works fine? I have a requirement to move my non-modal dialog when the frame is being dragged to another location. I tried adding mousemotionlistener to the frame, to the panel inside a frame, but the event does not reach my custom implementation of mousedrag event.
Any clues?

Moving the frame is a different listener: ComponentListener; add one to the frame. The frame's window decorations are OS territory, so I'm not sure if there's system dependence. I seem to vaguely remember some systems sending an event only after done moving, while others send the event as the frame moves.

Similar Messages

  • Consuming extra mouse drag events?

    Hi,
    In my mouse drag listener, there is a bit heavy processing that can take slightly long time (doing some real time computation). If I move the mouse fast, then there would be a long pause before processing catch up.
    So my question is that if it is possible to remove some mouse drag events in the queue s.t. my computation only takes on the latest drag event.
    I tried java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent(), but it always returns null.
    Anyone could give a hint? Thanks a lot.

    This heavy processing should be done in a new thread and not the event thread. If the event thread is busy processing, it's not going to be able to respond to drag events. Once you do that, it would be easy to set a flag in that thread to notify it to stop processing and start with new values.

  • Mouse dragged event with unexpected coordinates

    I am dragging the mouse on a half circle from the middle left to the top middle. This results in mouse events with the coordinates form (10,90) ->(100,10)
    Letting the mouse go and then dragging it further to the left, the coordinates in the of the event are similar than the starting point of the first mouse drag event.
    Can anyone shed some light on this peculiar behavior?

    First of, I have to apologize for the example not being as minimalistic as it might be, but on the plus side, I know now why this happens, I just don't know how to work around it.
    * To change this license header, choose License Headers in Project Properties.
    * To change this template file, choose Tools | Templates
    * and open the template in the editor.
    package javafxtest;
    import java.util.ArrayList;
    import javafx.application.Application;
    import javafx.beans.property.DoubleProperty;
    import javafx.beans.property.SimpleDoubleProperty;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Dimension2D;
    import javafx.geometry.Point2D;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.StackPane;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Circle;
    import javafx.scene.shape.Polygon;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.shape.Shape;
    import javafx.scene.transform.Rotate;
    import javafx.stage.Stage;
    * @author andi
    public class HandleRotation extends Application {
        private DoubleProperty currentRotation;
        private ArrayList<Double> angles;
        @Override
        public void start(Stage primaryStage) {
            currentRotation = new SimpleDoubleProperty(this, "currentRotation", 10);
            SteeringWheelGroup background = new SteeringWheelGroup(200);
            background.setManaged(false);
            Group g = new Group(background);
            final Point2D centerPoint = new Point2D(100, 100);
            angles = new ArrayList<>(3);
            angles.add(190.0);
            angles.add(270.0);
            angles.add(350.0);
            double step = (180.0 - 2 * currentRotation.doubleValue()) / (angles.size() - 1);
            int radius = 100;
            final int yTranslation = 15; // might be due to the labels
            Polygon handle = createHandle(centerPoint, radius, yTranslation);
            g.getChildren().add(handle);
            StackPane root = new StackPane();
            Scene scene = new Scene(g, 300, 250);
            primaryStage.setTitle("Handle Rotation!");
            primaryStage.setScene(scene);
            primaryStage.show();
         * Calculate the base point for the label. This is the point on the arc, matching the angle.
         * @param center point of the circle
         * @param radius radius of the circle
         * @param angle in degree in [0,180]
         * @return Point on the circle
        Point2D calculateBasePoint(Point2D center, double radius,
                double angle) {
            float newX = (float) (center.getX() + radius * Math.cos(Math.toRadians(angle)));
            float newY = (float) (center.getY() + radius * Math.sin(Math.toRadians(angle)));
            return new Point2D(newX, newY);
         * Create the polygon that represents the handle
         * @param centerPoint
         * @param radius
         * @return
        private Polygon createHandle(final Point2D centerPoint, int radius, final int yTranslation) {
            double baseAngle = 180;
            Point2D p1 = calculateBasePoint(centerPoint, radius, baseAngle - 5);
            Point2D p2 = calculateBasePoint(centerPoint, radius, baseAngle + 2);
            Point2D p3 = calculateBasePoint(centerPoint, radius*0.65, baseAngle + 2);
            Point2D p4 = calculateBasePoint(centerPoint, radius*0.65, baseAngle - 7);
            double[] points = {p1.getX(), p1.getY(), p2.getX(), p2.getY(), p3.getX(), p3.getY(), p4.getX(), p4.getY()};
                      Polygon polygon = new Polygon(points);
    //        polygon.setOpacity(0);
            polygon.setTranslateY(-yTranslation);
            final Rotate rotationTransform = new Rotate(currentRotation.doubleValue(), centerPoint.getX(), centerPoint.getY());
            polygon.getTransforms().add(rotationTransform);
            polygon.setOnMouseDragged(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    if (event.getY() < centerPoint.getY()) {
    System.out.println("Event: "+event);                   
                                                       Point2D point = new Point2D((float)event.getX(), (float)event.getY());
                        double newAngle = angleBetween2Lines(centerPoint, point);
                        if (newAngle < 0) {
                            newAngle = (90 + newAngle)+ 90;
    System.out.println("Set angle on mouse drag: "+newAngle);
                        if (newAngle < 10) {
                            newAngle = 10;
                        if (newAngle > 170) {
                            newAngle = 170;
                        currentRotation.set(newAngle);
            polygon.setOnMouseReleased(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    snapToNearestAngle();
                    rotationTransform.setAngle(currentRotation.doubleValue());
            return polygon;
         * Snap to the correct angle. Correct angle is angle belonging to the nearest label.
        void snapToNearestAngle() {
            double currentAngle = currentRotation.doubleValue() + 180;
            double currentMin = 360;
            int minIndex = 0;
    System.out.println("Current rotation is "+currentAngle);
            for (int i = 0; i < angles.size(); i++) {
                double angle = angles.get(i);
                double diff = Math.abs(angle - currentAngle);
                if (diff < currentMin) {
                    currentMin = diff;
                    minIndex = i;
    System.out.println("new minDifference at "+i+": "+diff);
            Double destinationAngle = angles.get(minIndex);
    System.out.println("DestinationAngle is "+currentAngle+" -> "+(destinationAngle - 180));
            if (destinationAngle < 180 + 10 || destinationAngle > 360 - 10) {
                throw new IllegalStateException("Angle is out of range: "+currentRotation.doubleValue()+" -> "+destinationAngle);
            currentRotation.set(destinationAngle - 180);
         * Calculate the angle between the vector horizontally to the left from the center
         * and the current point.
         * @param center point
         * @param point current point
         * @return angle in degree
        double angleBetween2Lines(Point2D center, Point2D point) {
            double slope2 = calculateSlope(center, point);
            double angle = Math.atan(slope2);
            if (point.getX() > center.getX()) {
                angle += Math.PI/2;
    System.out.println("Slope: "+slope2+" angle "+Math.toDegrees(angle));
            return Math.abs(Math.toDegrees(angle));
         * Caluculate the slope of the line defined by two points.
         * The first point is the center of a circle and the second
         * point roughly lies on the circle.
         * @param center point
         * @param point on the circle
         * @return slope of the connecting line.
        double calculateSlope(Point2D center, Point2D point) {
    System.out.println("center="+center+",point="+point);       
            double absSlope = Math.abs((point.getY() - center.getY()) / (point.getX() - center.getX()));
            if (point.getY() > center.getY()) {
                if (point.getX() > center.getX()) {
                    // bottom right
                    return -absSlope;
                } else {
                    // bottom left
                    return absSlope;
            } else {
                if (point.getX() > center.getX()) {
                    // top right
                    return absSlope;
                } else {
                    // top left
                    return -absSlope;
         * The main() method is ignored in correctly deployed JavaFX application.
         * main() serves only as fallback in case the application can not be
         * launched through deployment artifacts, e.g., in IDEs with limited FX
         * support. NetBeans ignores main().
         * @param args the command line arguments
        public static void main(String[] args) {
            launch(args);
       private class SteeringWheelGroup extends Group {
            public SteeringWheelGroup(int destinationWidth) {
                int topPadding = 0;
                Rectangle rect = new Rectangle(getImageWidth(), getImageWidth(), Color.RED);
                double scale = destinationWidth / rect.getWidth();
                rect.setScaleX(scale);
                rect.setScaleY(scale);
                Circle circle = new Circle(getImageWidth()/2, getImageWidth()/2, getImageWidth()/2, Color.BLUE);
                circle.setScaleX(scale);
                circle.setScaleY(scale);
                Group rotationGroup = new Group(/*rect,*/ circle);
                rotationGroup.setManaged(false);
                int width = getImageWidth();
                Rectangle clipRectangle = new Rectangle(0, 0, width, width / 2);
                Circle clipCircle = new Circle(width / 2, width / 2, width / 2);
                Shape clip = Shape.intersect(clipRectangle, clipCircle);
                rotationGroup.setClip(clip);
                this.getChildren().add(rotationGroup);
                //double h = calculateHeigthOverHorizon(angle, destinationWidth/2);
                //setTranslateY(-h+topPadding);
            public final int getImageWidth() {
                return 479;
    Here is how you can reproduce my effect:
    Grab the black handle
    Drag the mouse top and right until you approach the angle -90 (have an eye out on the console log)
    Let the mouse go: the handle will snap to 90 degree
    Grab the handle a second time and move further right
    You will see that the angle printed out do not match what you expect.
    Let the mouse go, the Handle snaps back to it's original position
    As the rotation does not happen around the polygon's center, I have to use a Rotaion effect, which is applied. While I can drag the shape from the rotated location the dragging is always measured from its base position.
    So what can I do to work around this?
    final Rotate rotationTransform = new Rotate(currentRotation.doubleValue(), centerPoint.getX(), centerPoint.getY());
    polygon.getTransforms().add(rotationTransform);
    If worse comes to worst, I can use a circular handle covering everything, then I can rotate around its center, but I would like to avoid this.

  • Simulating mouse drag events?

    Hi all,
    I am wrinting unit tests for my swing application. For one test I want to simulate a drag event over a panel. I have tried JFCUnit, but does not seem to work for this, so I am trying to write my own.
    I create 3 mouse events and post them on the system event queue. A mouse press event, a mouse drag event and a mouse release event. MouseEvent's do let you specify a drag start and a drag end point in their constructor. So I have tried using both, but neither works.
    Am I doing anything wrong? The component I'm operating on gets the mouse pressed and mouse released events, but thats all.
    any help much appreciated,
    Justin

    I tried using the Robot class alright, but it does really wierd things. I sometimes doesn't work for simulating dragging events. I have a component that you can drag anywhere on the screen using the mouse, without having to use the titlebar. I am trying to test this dragging, but with the robot class, it looks like it goes into an infinate recursion. The mouseDragged method gets executed thosands of times, and you can see the panel shifting from its origional position to the new position and back again for a few seconds. Could be a bug in Robot class.

  • Mouse dragged event - problem(logic problem?)

    Hi! I have a window which is started by a frame. At the moment I have a Mouse Dragged event. The ideea is that I would like to drag the window to various parts of the screen but as it is the window flickers a lot and it keeps on jumping to various locations when dragging it. Is there a way to redraw and move the window only once the mouse button was released from the drag and not all the time?!
    Thank you.

    if i understood your question correct setVisible(false) when you grab it setVisivble(true) when you release it. If you want it to be still shown in the ori�ginal place while dragging make a second window that stays at the starting location and id removed after the first diappears.
    An even better solution would be to remember the location of the mouse in a pousepressed event and then wait for mousereleased. (and set a boolean true if the mouse pressed was inside the window).

  • JTable custom selection and mouse drag events

    Hello
    I am currently experiencing a problem when using a JTable and a custom selection. I have made a small example to demonstrate the probem. Selection works for this example by listening for when the user clicks or clicks and drags (button held down) and moves the mouse across cells in the table. For each MouseEvent received in the MouseMotionListener mouseDragged method I store the coordinates of that cell at the point of the mouse and render the cell at those coordinates with a line border allowing a more versatile cell selection. The problem that occurs is when you click+drag and move the mouse fast, it looks MouseEvents are created every x milliseconds so when you move fast there isn't a MouseEvent raised for each cell in the click+drag from A -> B. If you run the following example then click and hold down the mouse button and move fast downwards from the top of the table to the bottom you can see that not all the cells are selected vertically.
    Is there someway of increasing the mouse poll (if this is indeed the problem) during the click+drag or a better solution to this problem that any one knows!?
    I have tried attaching the example but it exceeded the message length for the forum post here is a link to code
    [http://www.oneandonlyluppy.pwp.blueyonder.co.uk/TableTest.java]
    [http://www.oneandonlyluppy.pwp.blueyonder.co.uk/TableTest.zip] <-- Contains the source and compiled classes
    I'll try adding the code again as a separate post
    Thanks
    Edited by: oneandonlyluppy on Jan 8, 2009 2:44 AM
    Edited by: oneandonlyluppy on Jan 8, 2009 2:45 AM

    AFAIK the mouse polling rate is OS dependent (being interrupt driven), and may even be affected by processor load. What you could do is store the mouse location (Point) of the last mouseDragged event, and compute a line to the current location, then use some coordinate geometry to identify any intervening cells which are presently being skipped.
    db

  • Mouse dragging events in NSWindow and NSView

    Hi, I have built and application that uses a single window that contains multiple components within it. The main component of the window is a custom NSView subclass that contains a number of CALayers. I want to be able to move these layers around the NSView subclass based on the mouseDown, mouseDragged, and mouseUp events entered by the user. I can detect and process mouse events fine within the NSView subclass, however, whenever I drag the mouse within the NSView subclass right after a mouseDown event, the WHOLE WINDOW will move. I do not want that to happen, that is, when I am dragging the mouse within my NSView subclass, I do not want the whole window to move. I want my CALayers, within the NSView, to move according to the mouse events that I am correctly tracking in the NSView subclass. I will very much appreciate any suggestions. Thank you very much in advance.

    Thank you very much for your response. Your tip is very useful. What I did before was change the window type in Interface Builder: replace the textured window with a regular window. This solved the problem, however, I could not find the property that needed to be adusted to control the window behavior. I learned something useful with your tip. Thanks again.

  • Mouse drag event available for art objects?

    I want to receive event as user drag an art object so I can continuously monitor its position on the artboard.
    Anyone know how to do this? Thanks so much.

    You can take a look at the multiarrowtool in adobes sample code. That should give you the code required. These two functions allow for you to get the mouse postion.
    ASErr MultiArrowToolPlugin::AddAnnotator(SPInterfaceMessage *message)
    ASErr result = kNoErr;
     try
    result = sAIAnnotator->AddAnnotator(message->d.self,"MultiArrowTool Annotator", &fAnnotatorHandle);aisdk::check_ai_error(result);
    result = sAIAnnotator->SetAnnotatorActive(fAnnotatorHandle,
    false);aisdk::check_ai_error(result);
    catch (ai::Error& ex){
    result = ex;
    catch(...){
    result = kCantHappenErr;
    return result;}
    */ASErr MultiArrowToolPlugin::DrawAnnotator(AIAnnotatorMessage* message)
    ASErr result = kNoErr;
     try
     // Invalid previous annotator.
    result = sAIAnnotator->InvalAnnotationRect(NULL, &oldAnnotatorRect);
     // Get the string to display in annotator.
    ai::UnicodeString pointStr;
     //result = this->GetPointString(fEndPoint, pointStr);
    result =this->GetPointString(fStartingPoint, pointStr);aisdk::check_ai_error(result);
    AIPoint annotatorPoint;
    result = sAIDocumentView->ArtworkPointToViewPoint(NULL, &fEndPoint, &annotatorPoint);
    // Move 5 points right and 5 points up.
    annotatorPoint.h += 5;
    annotatorPoint.v -= 5;
     // Find cursor bound rect.
    AIRect annotatorRect;
    result = sAIAnnotatorDrawer->GetTextBounds(message->drawer, pointStr, &annotatorPoint, annotatorRect);
    aisdk::check_ai_error(result);
     //Draw a filled rectangle, the following R, G and B values combined makes light yellow.
     unsigned short red = 65000; 
    unsigned short green = 65000; 
    unsigned short blue = 40000;ADMRGBColor yellowFill = {red, green, blue};
    sAIAnnotatorDrawer->SetColor(message->drawer, yellowFill);
    result = sAIAnnotatorDrawer->DrawRect(message->drawer, annotatorRect,
    true);aisdk::check_ai_error(result);
    //Draw black outline, 0 for R, G and B makes black.
     unsigned short black = 0;ADMRGBColor blackFill = {black, black, black};
    sAIAnnotatorDrawer->SetColor(message->drawer, blackFill);
    sAIAnnotatorDrawer->SetLineWidth(message->drawer, 0.5);
    result = sAIAnnotatorDrawer->DrawRect(message->drawer, annotatorRect,
    false);aisdk::check_ai_error(result);
    // Draw cursor text.
    result = sAIAnnotatorDrawer->SetFontPreset(message->drawer, kAIAFSmall);
    aisdk::check_ai_error(result);
    result = sAIAnnotatorDrawer->DrawTextAligned(message->drawer, pointStr, kAICenter, kAIMiddle, annotatorRect);
    aisdk::check_ai_error(result);
     // Save old rect
    oldAnnotatorRect = annotatorRect;
     catch (ai::Error& ex){
    result = ex;
    return result;}
    */ASErr MultiArrowToolPlugin::GetPointString(const AIRealPoint& point, ai::UnicodeString& pointStr){
    ASErr result = kNoErr;
    try
    ASInt32 precision = 2;
    ai::UnicodeString horiz, vert;
    ai::NumberFormat numFormat;
    horiz = numFormat.toString((float) point.h, precision, horiz);vert = numFormat.toString((
    float) -point.v, precision, vert);pointStr.append(ai::UnicodeString(
    "h: ").append(horiz)
    .append(ai::UnicodeString(
    ", v: ").append(vert)));
    catch (ai::Error& ex){
    result = ex;
    return result;}

  • Mouse drag  event

    I'm trying to get the end position for a drag mouse event, but this will only gives me the starting position. And if I try to use Mousereleased() this doesn't get call during a drag. What I'm trying to do is if the user drags an item outside a dialog window, then I remove it from a list. Any suggestions?

    Hi !
    You have to overwrite the methods processMouseEvent(MouseEvent e) ans processMouseMotionEvent(MouseEvent e) from the JComponent.
    Example:
    public class YourClass{
      private Point clickedPoint;
      protected void processMouseEvent(MouseEvent e){
       if(e.getId() == MouseEvent.MOUSE_PRESSED){
        clickedPoint = e.getPoint();
       }else if(e.getID() == MouseEvent.MOUSE_RELEASED){
        clickedPoint = null;
       super.processMouseEvent(e);
      protected void processMouseMotionEvent(MouseEvent e){
        if(e.getId() == MouseEvent.MOUSE_DRAGGED){
          //do something
        super.processMouseMotionEvent(e);
    }

  • How can i implement a mouse listener event on jtable cell?

    I create JTable using a resultset,at the end of each row i add an image using JLabel(set imageicon of the JLabel).
    i want to track the event when user click on that image.
    What can i do for that?.
    I tried by implementing mouseListener interface for the JLabel but it's not working properly.

    Hi,
    Add MouseListener to the JTable.
    when the user clicks on the table use the method
    getValueAt( int selectedRow,int selectedColumn) to get the contents.
    Object obj = getValueAt( int selectedRow,int selectedColumn) .
    (If obj instance of JLabel)
    do your functionality.
    Hope this helps
    Cheers :)
    Nagaraj

  • How to get  the mouse drag event ?

    I Have a JTextField and I want to move a selected text in the JTextField from a location to another by pressing the mouse on selected text and dragging it to newer
    location in the same text field (Same as Microsoft word does).Will u help me out please .

    But i can't get it working for the same component i.e dragging a text from the JTextField and dropping it in the same text field
    will u please help me with the sample code for 1 JTextField.I will really be very thankful to u
    Please

  • Check mouse drag event in ListBox

    Hi,
           I want to check whether the mouse is dragged or not in List box without setting the property dragEnabled.
    Regards,
    Jayagopal.

    may be you can do this mouseDown -> listen mouseMove-> on mouseUp -> remove mousemove

  • Scroll JTable in Scrollpane with mouse drag

    Hello developers !
    I'm trying to make a scrollable Jtable. The table have to be scrollable with the mouse drag event. But I have a "flashing" Problem. I can catch the Mouse events from the table (I'm listener the mouse motion and mouse events).
    When I receive a new mouse drag event, I set the new position from the viewport. The problem is, that the Table flash:
    For example:
    I drag the mouse to the bottom of the table. The mouse "y" position have to increase, but it doesn't:
    first motion event position (10, 10)
    second motion event position (10, 15)
    third motion event position (10, 12)
    etc..
    The position of the mouse event are in relation of the component position. I think, the problem is that I change the position of the view port and than the new mouse event is "on a wrong reference".
    Could someone help me? How could I make a work around for this Problem?

    I have the solution... it is easy.
    I post the solution because i spent two days making working around (changing viewport position other scrollbar values, etc).
    You dont need to implement the Autoscroll interface. The Autoscroll interface is for Drag and Drop classes.
    The key was the function JTable#scrollRectToVisible....
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class ScrollableTableFrame extends JFrame{
      protected ScrollableTable table;
      public ScrollableTableFrame() {
        super("Scrollable Table");
        setSize(600, 300);
        String data[][] = new String[40][40];
        String header[] = new String[40];
        for(int i = 0; i < 40; i++){
          header[i] = "Header " + i;
          for(int j = 0; j < 40; j++){
            data[i][j] = "(" + i + ", " + j +")";
        ScrollableTable table = new ScrollableTable(data, header);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        JScrollPane sp = new JScrollPane();
        sp.getViewport().setBackground(table.getBackground());
        sp.getViewport().add(table);
        getContentPane().add(sp, BorderLayout.CENTER);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(400, 400);
        setVisible(true);
      public static void main(String args[]){
        new ScrollableTableFrame();
    class ScrollableTable extends JTable{
      private Point firstPressedPoint;
      public ScrollableTable(Object rowData[][], Object columnNames[]){
        super(rowData, columnNames);
      protected void processMouseEvent(MouseEvent e){
        int id = e.getID();
        switch(id) {
          case MouseEvent.MOUSE_PRESSED:
            firstPressedPoint = e.getPoint();
            break;
          case MouseEvent.MOUSE_RELEASED:
            firstPressedPoint = null;
            break;
          case MouseEvent.MOUSE_CLICKED:
          case MouseEvent.MOUSE_EXITED:
          case MouseEvent.MOUSE_ENTERED:
        super.processMouseEvent(e);
      protected void processMouseMotionEvent(MouseEvent e){
        if(e.getID() == MouseEvent.MOUSE_DRAGGED){
          Rectangle r = getVisibleRect();
          Point p = e.getPoint();
          int dx = (firstPressedPoint.x-p.x);
          int dy = (firstPressedPoint.y-p.y);
          Rectangle aRect = new Rectangle(r.x + dx, r.y + dy , r.width + dx, r.height + dy);
          scrollRectToVisible(aRect);
    }P.S.: jarshe, thank you for your help !!

  • Mouse Drag is not working in Applets

    In our application we are using applets in containing in IFRAMES in IE to display different type of graphs and animations etc. User can open/close these Applets and iframes to navigate from one data view to other. During this navigation sometimes mouse drag event stops and all drag related operations like scrolls etc stops responding to drag operations in all applets in same JVM.
    My investigation shows that swing component hierarchy gets corrupted somehow and this exception is thrown
    EventMulticaster.eventDispatched(Toolkit.java:2244)
         at java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2203)
         at java.awt.Component.dispatchEventImpl(Component.java:4528)
         at java.awt.Container.dispatchEventImpl(Container.java:2099)
         at java.awt.Component.dispatchEvent(Component.java:4460)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4603)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Component.dispatchEvent(Component.java:4460)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    peerComponents in Container class is returning null on call to getLocationOnScreen that causes this exception.
    I fixed the issue in awt library but ORACLE license terms don't allow redistribution of modified version of awt.
    Please help me fix this issue in applet code or suggest me to bypass license restrictions.
    Thanks in advance!
    Luqman

    877922 wrote:
    peerComponents in Container class is returning null on call to getLocationOnScreen that causes this exception.
    I fixed the issue in awt library but ORACLE license terms don't allow redistribution of modified version of awt.Something Oracle do allow is to raise a bug report. On that report they invite you to post a work-around or fix. That would be the place to put the fix you have devised. Oracle will (supposedly) fix it, then you (and everyone else) can enjoy the fix as a free upgrade in the next version.
    They also offer 'support contracts' (AFAIU) in which you might pursue your own immediate fixes. But raise the bug report anyway.

  • Drag events in Robot class

    I am using the Robot class in jdk1.3.1 to record and playback user input. I am getting the list of events and then traversing on it to do the appropriate action, mouse move, key events are played back fine, but I am unable to do mouse drag event.
    Here is simplified version of the code:
    for(int i = 0; i < aListEvents.size(); i++)
    AWTEvent event = (AWTEvent)aListEvents.get(i);
    Component c = (Component)event.getSource();
    int id = event.getID();
    switch(id)
    case MouseEvent.MOUSE_MOVED:
    int x = ((MouseEvent)e).getX();
    int y = ((MouseEvent)e).getY();
    m_robot.mouseMove(x,y);
    break;
    case KeyEvent.KEY_PRESSED:
    m_robot.keyPress(((KeyEvent)e).getKeyCode());
    break;
    case MouseEvent.MOUSE_DRAGGED:
         // do component drag
    break;
    Is there a way to mimic the drag event during playback and drag the object that was dragged during record?
    Any suggestions would be greatly appreciated!!
    Thanks :)

    This is an old posting, so the answer is probably too late for mamta and has also been answered elsewhere. But for whoever comes across this one, share my piece of experience:
    There's no one-to-one mapping between Java events and the system events (which is what Robot is refering to).
    After all, a MOUSE_DRAGGED is nothing but a MOUSE_MOVE after a MOUSE_PRESSED. So you can send a MOUSE_DRAGGED along to the robot as a mouseMove, because the Robot/system keeps in mind that the mouse button has been pressed before and therefor the event will appear in the Java event queue as a MOUSE_DRAGGED.
    Similar is MOUSE_CLICKED which needn't be replayed at all, because sending a MOUSE_PRESSED and a MOUSE_RELEASED to the Robot will automatically produce a MOUSE_CLICKED in the Java event queue as well.
    Same with the key strokes.

Maybe you are looking for

  • Download on new computer?

    Hi, I have Illustrator, Indesign and Photoshop elements. Now I got a new computer and I want these to be installed on the new one. How can I do that? I try to add products to my profile but it says the serialnumber already is registreated even though

  • JDev 10.1.3.0.4 - Different source path from development to execution?

    Hi, I've just migrated to JDev 10.1.3.0.4. Getting a java.lang.NoSuchMethodError in execution while class is correctly available in development IDE. I'm almost sure this is a bug, I want to investigate this issue otherwise I can't migrate. I think em

  • How to choose Mail (Mapi) when clicking "Export" in the Report Viewer

    I'm using .net 2008 and CR 2008 for reporting. In a form I placed the ReportViewer. Everything works fine. Here my problem: When I click "Export" in the Viewer I get the File-Dialog with Excel, Word, PDF. But I'm missing the Dialog where I can choose

  • [newbie] problem to start blazeds

    hi, i had download blazeds 5 minutes ago. i want to start the server and try this : (mac os x terminal) "cd" in the bin directory "./catalina.sh run" to start the server but I get this error: Exception in thread "main" java.lang.NoClassDefFoundError:

  • Unable to locate Apple TV on my TV

    Unable to locate appletv on my tv?