Re: Draggable window only works in MS JVM, and not Sun?



Thanks Andrey for your response. Unfortunately, I am using Java 1.1
(and need to), is there any equivalent for non-Swing?
Thanks
Aaron

Andrey Kuznetsov wrote:
> > public class TestWindow extends Window {
> > Label title;
> > int width=300;
> > int height=300;
> > Point origin = new Point();
> >
> > TestWindow() {
> > super(new Frame(""));
> >
> > this.setBackground(Color.blue);
> > title = new Label("Draggable window");
> > title.setBackground(Color.gray);
> > //setLayout(new BorderLayout());
> > add(title, BorderLayout.NORTH);
> >
> > title.addMouseMotionListener(new MouseMotionAdapter() {
> > public void mouseDragged(MouseEvent e) {
> >
> > Point p = getLocation();
> > setLocation(p.x + e.getX() - origin.x,
> > p.y + e.getY() - origin.y);
> >
> > }
> > });
> >
> > title.addMouseListener(new MouseAdapter() {
> > public void mousePressed(MouseEvent e) {
> > origin.x = e.getX();
> > origin.y = e.getY();
> > }
> > });
> >
> > this.setSize(width, height);
> > this.show();
> > }
> > }
>
> you should convert all coordinates to absolute (screen) coordinates
> SwingUtilities.convertPointToScreen().
>
> --
> Andrey Kuznetsov
> http://uio.imagero.com Unified I/O for Java
> http://reader.imagero.com Java image reader
> http://jgui.imagero.com Java GUI components and utilities

.



Relevant Pages

  • Re: destroying swing component
    ... Andrey Kuznetsov wrote: ... >> I need to hold references to these objects because swing components ... > http://uio.imagero.com Unified I/O for Java ...
    (comp.lang.java.gui)
  • Re: UIDefaults.put() issue
    ... "Andrey Kuznetsov" wrote in message ... >> For whatever reason, I am unable to alter the value in the UIManager ... > http://uio.imagero.com Unified I/O for Java ... rather than a LookAndFeelDefaults. ...
    (comp.lang.java.gui)
  • Re: UIDefaults.put() issue
    ... > "Andrey Kuznetsov" wrote in message ... >>> For whatever reason, I am unable to alter the value in the UIManager ... >> http://uio.imagero.com Unified I/O for Java ... >> http://jgui.imagero.com Java GUI components and utilities ...
    (comp.lang.java.gui)
  • Re: JPEG file size
    ... Andrey Kuznetsov wrote: ... file size of JPEG file from the file header. ... http://uio.imagero.com Unified I/O for Java ... http://jgui.imagero.com Java GUI components and utilities ...
    (comp.graphics.misc)
  • Re: How do i remove " Trojan Horse Generic2.dbs"
    ... it helps immensely if you include all of previous messagein your replies to the newsgroup. ... We have no idea to whom you're replying, Aaron. ... then install new Java" well I uninstalled java first now i am not ...
    (microsoft.public.windowsxp.general)