Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScript Beginner Tutorial/99 Others/02 Title Clock.js')
-rw-r--r--JavaScript Beginner Tutorial/99 Others/02 Title Clock.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/JavaScript Beginner Tutorial/99 Others/02 Title Clock.js b/JavaScript Beginner Tutorial/99 Others/02 Title Clock.js
new file mode 100644
index 0000000..d0c2fa4
--- /dev/null
+++ b/JavaScript Beginner Tutorial/99 Others/02 Title Clock.js
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Christian Pontesegger and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christian Pontesegger - initial API and implementation
+ *******************************************************************************/
+
+var formatter = java.text.SimpleDateFormat("yyyy-MM-dd, HH:mm:ss")
+time = formatter.format(java.lang.System.currentTimeMillis());
+
+// change application title
+loadModule('/System/UI');
+executeUI('getShell().setText("' + time + '")');
+
+// sleep 1s
+java.lang.Thread.sleep(1000);
+
+// restart script
+loadModule('/System/Scripting');
+fork(getScriptEngine().getExecutedFile()); \ No newline at end of file

Back to the top