How to make the AbsoluteMouse on the JMEDesktop?

Oh, that's bad. Then we have to change that. Can you describe how you have set up the listeners?

irrisor said:
Oh, that's bad. Then we have to change that. Can you describe how you have set up the listeners?

I just post you some code parts... they're quite self-explanatory ;)

Creating the 'dragger':

listener = new Listener();
draggerBottom = new JLabel("="); // TODO: use an image
draggerBottom.setHorizontalAlignment((int)JLabel.CENTER_ALIGNMENT);
draggerBottom.setVerticalAlignment((int)JLabel.CENTER_ALIGNMENT);
draggerBottom.setLocation(frameBottom.getContentPane().getWidth() - 15, 0);
draggerBottom.setSize(15, 100);
draggerBottom.addMouseMotionListener(listener);
frameBottom.add(draggerBottom);



And this is the listener:

private class Listener implements ActionListener, MouseMotionListener
{
(...)
    public void mouseDragged(MouseEvent eve)
    {
        Object source = eve.getSource();

        if(source == draggerBottom)
        {
            java.awt.Point p = frameBottom.getLocation();
            p.x += eve.getX() - draggerBottom.getWidth() / 2;
            if(p.x < -(frameBottom.getWidth() - 20))
                p.x = -(frameBottom.getWidth() - 20);
            if(p.x > -5)
                p.x = -5;
            frameBottom.setLocation(p);
        }
        else if(source == draggerRight)
        {
            java.awt.Point p = frameRight.getLocation();
            p.y += eve.getY() - draggerRight.getHeight() / 2;
            if(p.y < -(frameRight.getHeight() - 20))
                p.y = -(frameRight.getHeight() - 20);
            if(p.y > -5)
                p.y = -5;
            frameRight.setLocation(p);
        }
    }
(...)
}


Basically, I have a label on the frames (JInternalFrame) used to drag them along one axis (one horizontally, one vertically). Much like the messages panel in Rollercoaster Tycoon 3.