Hi, I was trying to put together a tooltip function for my jedit macros so I could have a different way of notification than the classic message box, but I am stuck.

- unless I put a message box before the sleep command, I do not even see the tooltip
- during the sleep period jedit is unresponsive

I am no java programmer - I think that my problem might be solved by using different threads, but it goes over my head. Any help would be appreciated.

Thanks, tvojeho



Code:

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ToolTip]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Adapted from 'boot_notification.bsh' - version 1.1 by Claudio Vicari 18/04/2005

ToolTip(String Text, int X, int Y, long milliseconds)
  {
  JWindow note = new JWindow();
  note.setAlwaysOnTop(true);
  note.setBackground( Color.WHITE );

  JPanel jp = new JPanel();
  jp.setBorder( BorderFactory.createLineBorder(Color.BLACK) );
  jp.setBackground( Color.WHITE );
  jp.add( new JLabel(Text) );
  note.getContentPane().add( jp );

  note.pack();

  note.setLocation(X,Y);
  note.setVisible(true);

    //-- Sleep
  Thread.currentThread().sleep(milliseconds);

  note.dispose();
  }

ToolTip("tooltip text", 0, 0, 5000);