- <!------ HTML File --------------------------------->
- <html>
- <head>
- <title></title>
- <!-- JavaScript -->
-
- <!--
- /**
- * @comment: The prototype library 1.4
- * @import: prototype
- */
- -->
- <script
- src="lib/js/prototype.js"
- type="text/javascript">
- </script>
-
- <!--
- /**
- * @comment: The Text class
- * @import: Text
- */
- -->
- <script
- src="lib/js/WWTLoader.js"
- type="text/javascript">
- </script>
-
-
- <!--
- /**
- * @comment: The test main function presents all the WWT functionnalities
- * @import: test
- */
- -->
- <script
- src="lib/test/testToolTip.js"
- type="text/javascript">
- </script>
- <!-- CSS -->
-
- </head>
- <body onload="new WWTLoader('lib/js/', main);">
- </body>
- </htlm>
-
- <!------ Javascript file --------------------------------->
- function main(args){
- /* Instancie le display et la fenêtre de la WWT */
- var display = new Display();
- var shell = new Shell(display);
-
- /* Crée le champ texte */
- var label = new Label(shell, WWT.CENTER | WWT.SHADOW_NONE);
- label.setText("Move mouse hover...");
- label.setLocation( ( shell.getSize().x - 200 ) / 2, ( shell.getSize().y - 20 ) / 2);
- label.setSize(200, 20);
-
- /* Crée le listener de souris */
- var mouseMoveListener = new MouseMoveListener();
- mouseMoveListener.mouseMove = function(e){
- var tt = new ToolTip(shell, WWT.NONE);
- tt.setText("My tool tip");
- tt.setMessage("An other message here");
- tt.setLocation( (Math.random() * 10000) % shell.getSize().x, (Math.random() * 10000) % shell.getSize().y );
- tt.setVisible(true);
- };
-
- var tt1 = new ToolTip(shell, WWT.BALLOON);
- tt1.setText("A balloon Tool tip");
- tt1.setMessage("Your mouse down");
- tt1.setLocation( label.getLocation().x, label.getLocation().y + label.getSize().y);
-
- var mouseListener = new MouseListener();
- mouseListener.mouseDown = function(e){
- if( !tt1.getVisible())
- tt1.setVisible(true);
- };
-
- var tt2 = new ToolTip(shell, WWT.BALLOON);
- tt2.setText("An other balloon Tool tip");
- tt2.setMessage("Your mouse up");
- tt2.setLocation( label.getLocation().x + label.getSize().x, label.getLocation().y);
-
- label.addMouseMoveListener(mouseMoveListener);
- mouseListener.mouseUp = function(e){
- if( !tt2.getVisible())
- tt2.setVisible(true);
- };
- label.addMouseListener(mouseListener);
- }
<!------ HTML File --------------------------------->
<html>
<head>
<title></title>
<!-- JavaScript -->
<!--
/**
* @comment: The prototype library 1.4
* @import: prototype
*/
-->
<script
src="lib/js/prototype.js"
type="text/javascript">
</script>
<!--
/**
* @comment: The Text class
* @import: Text
*/
-->
<script
src="lib/js/WWTLoader.js"
type="text/javascript">
</script>
<!--
/**
* @comment: The test main function presents all the WWT functionnalities
* @import: test
*/
-->
<script
src="lib/test/testToolTip.js"
type="text/javascript">
</script>
<!-- CSS -->
</head>
<body onload="new WWTLoader('lib/js/', main);">
</body>
</htlm>
<!------ Javascript file --------------------------------->
function main(args){
/* Instancie le display et la fenêtre de la WWT */
var display = new Display();
var shell = new Shell(display);
/* Crée le champ texte */
var label = new Label(shell, WWT.CENTER | WWT.SHADOW_NONE);
label.setText("Move mouse hover...");
label.setLocation( ( shell.getSize().x - 200 ) / 2, ( shell.getSize().y - 20 ) / 2);
label.setSize(200, 20);
/* Crée le listener de souris */
var mouseMoveListener = new MouseMoveListener();
mouseMoveListener.mouseMove = function(e){
var tt = new ToolTip(shell, WWT.NONE);
tt.setText("My tool tip");
tt.setMessage("An other message here");
tt.setLocation( (Math.random() * 10000) % shell.getSize().x, (Math.random() * 10000) % shell.getSize().y );
tt.setVisible(true);
};
var tt1 = new ToolTip(shell, WWT.BALLOON);
tt1.setText("A balloon Tool tip");
tt1.setMessage("Your mouse down");
tt1.setLocation( label.getLocation().x, label.getLocation().y + label.getSize().y);
var mouseListener = new MouseListener();
mouseListener.mouseDown = function(e){
if( !tt1.getVisible())
tt1.setVisible(true);
};
var tt2 = new ToolTip(shell, WWT.BALLOON);
tt2.setText("An other balloon Tool tip");
tt2.setMessage("Your mouse up");
tt2.setLocation( label.getLocation().x + label.getSize().x, label.getLocation().y);
label.addMouseMoveListener(mouseMoveListener);
mouseListener.mouseUp = function(e){
if( !tt2.getVisible())
tt2.setVisible(true);
};
label.addMouseListener(mouseListener);
}