aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrkam <none@none>2011-03-24 18:54:41 +0100
committermrkam <none@none>2011-03-24 18:54:41 +0100
commitac3a07391c0887d3dd351d7712ba47cb029c7505 (patch)
tree726f42cacb72d95306cc6d9b89325d8a26843ffd
parent91589f535fc117d4b9546af91d4b5f1c30aac4a4 (diff)
downloadjdk8u_jdk-ac3a07391c0887d3dd351d7712ba47cb029c7505.tar.gz
7027849: New demo for Shaped/Translucent windows feature needs to be created
Reviewed-by: rupashka
-rw-r--r--src/share/demo/jfc/TransparentRuler/README.txt14
-rw-r--r--src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java234
-rw-r--r--src/share/demo/nbproject/jfc/TransparentRuler/build.properties22
-rw-r--r--src/share/demo/nbproject/jfc/TransparentRuler/build.xml91
-rw-r--r--src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml46
-rw-r--r--src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml98
-rw-r--r--src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml81
-rw-r--r--src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml173
8 files changed, 759 insertions, 0 deletions
diff --git a/src/share/demo/jfc/TransparentRuler/README.txt b/src/share/demo/jfc/TransparentRuler/README.txt
new file mode 100644
index 0000000000..ddcf9de1d5
--- /dev/null
+++ b/src/share/demo/jfc/TransparentRuler/README.txt
@@ -0,0 +1,14 @@
+
+To run the Ruler demo:
+
+ java -jar Ruler.jar
+
+These instructions assume that this installation's version of the java
+command is in your path. If it isn't, then you should either
+specify the complete path to the java command or update your
+PATH environment variable as described in the installation
+instructions for the Java(TM) SE Development Kit.
+
+KNOWN ISSUES:
+Context menu is clipped with the window shape. The issues are:
+CR 7027486 JPopupMenu doesn't take window shape into account
diff --git a/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java b/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java
new file mode 100644
index 0000000000..707151f971
--- /dev/null
+++ b/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package transparentruler;
+
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsDevice.WindowTranslucency;
+import java.awt.GraphicsEnvironment;
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Path2D.Float;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JFrame;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+
+
+/**
+ * This sample demonstrates shaped and translucent window feature.
+ * @author Alexander Kouznetsov
+ */
+@SuppressWarnings("serial")
+public class Ruler extends JFrame {
+
+ private static final Color BACKGROUND = Color.RED;
+ private static final Color FOREGROUND = Color.WHITE;
+ private static final int OPACITY = 180;
+ private static final int W = 70;
+ private static final int F_HEIGHT = 400;
+ private static final int F_WIDTH = (int) (F_HEIGHT * 1.618 + 0.5);
+
+ private static void checkTranslucencyMode(WindowTranslucency arg) {
+ GraphicsEnvironment ge =
+ GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice gd = ge.getDefaultScreenDevice();
+ if (!gd.isWindowTranslucencySupported(arg)) {
+ System.err.println("'" + arg
+ + "' translucency mode isn't supported.");
+ System.exit(-1);
+ }
+ }
+ private final ComponentAdapter componentListener = new ComponentAdapter() {
+
+ /**
+ * Applies the shape to window. It is recommended to apply shape in
+ * componentResized() method
+ */
+ @Override
+ public void componentResized(ComponentEvent e) {
+ int h = getHeight();
+ int w = getWidth();
+ float a = (float) Math.hypot(h, w);
+ Float path = new java.awt.geom.Path2D.Float();
+ path.moveTo(0, 0);
+ path.lineTo(w, 0);
+ path.lineTo(0, h);
+ path.closePath();
+ path.moveTo(W, W);
+ path.lineTo(W, h - W * (a + h) / w);
+ path.lineTo(w - W * (a + w) / h, W);
+ path.closePath();
+ setShape(path);
+ }
+ };
+ private final Action exitAction = new AbstractAction("Exit") {
+
+ {
+ putValue(Action.MNEMONIC_KEY, KeyEvent.VK_X);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ System.exit(0);
+ }
+ };
+ private final JPopupMenu jPopupMenu = new JPopupMenu();
+
+ {
+ jPopupMenu.add(new JMenuItem(exitAction));
+ }
+ /**
+ * Implements mouse-related behavior: window dragging and popup menu
+ * invocation
+ */
+ private final MouseAdapter mouseListener = new MouseAdapter() {
+
+ int x, y;
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (e.getButton() == MouseEvent.BUTTON1) {
+ x = e.getX();
+ y = e.getY();
+ }
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
+ setLocation(e.getXOnScreen() - x, e.getYOnScreen() - y);
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ jPopupMenu.show(getContentPane(), e.getX(), e.getY());
+ }
+ }
+ };
+ /**
+ * Implements keyboard navigation. Arrows move by 5 pixels, Ctrl + arrows
+ * move by 50 pixels, Alt + arrows move by 1 pixel.
+ * Esc exits the application.
+ */
+ private final KeyAdapter keyboardListener = new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ int step = e.isControlDown() ? 50 : e.isAltDown() ? 1 : 5;
+ switch (e.getKeyCode()) {
+ case KeyEvent.VK_LEFT:
+ setLocation(getX() - step, getY());
+ break;
+ case KeyEvent.VK_RIGHT:
+ setLocation(getX() + step, getY());
+ break;
+ case KeyEvent.VK_UP:
+ setLocation(getX(), getY() - step);
+ break;
+ case KeyEvent.VK_DOWN:
+ setLocation(getX(), getY() + step);
+ break;
+ case KeyEvent.VK_ESCAPE:
+ exitAction.actionPerformed(null);
+ }
+ }
+ };
+
+ public Ruler() {
+ setUndecorated(true);
+
+ // Enables perpixel translucency
+ setBackground(new Color(BACKGROUND.getRed(), BACKGROUND.getGreen(),
+ BACKGROUND.getBlue(), OPACITY));
+
+ addMouseListener(mouseListener);
+ addMouseMotionListener(mouseListener);
+ addComponentListener(componentListener);
+ addKeyListener(keyboardListener);
+ setContentPane(new JPanel() {
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ Graphics gg = g.create();
+ int w = getWidth();
+ int h = getHeight();
+ int hh = gg.getFontMetrics().getAscent();
+ gg.setColor(FOREGROUND);
+ for (int x = 0; x < w * (h - 8) / h - 5; x += 5) {
+ boolean hi = x % 50 == 0;
+ gg.drawLine(x + 5, 0, x + 5,
+ hi ? 20 : (x % 25 == 0 ? 13 : 8));
+ if (hi) {
+ String number = Integer.toString(x);
+ int ww = gg.getFontMetrics().stringWidth(number);
+ gg.drawString(number, x + 5 - ww / 2, 20 + hh);
+ }
+ }
+ gg.dispose();
+ }
+ });
+ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ setSize(F_WIDTH, F_HEIGHT);
+ setLocationByPlatform(true);
+ }
+
+ /**
+ * @param args the command line arguments are ignored
+ */
+ public static void main(String[] args) throws InterruptedException, InvocationTargetException {
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSLUCENT);
+ checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSPARENT);
+
+ Ruler ruler = new Ruler();
+ ruler.setVisible(true);
+ }
+ });
+ }
+}
diff --git a/src/share/demo/nbproject/jfc/TransparentRuler/build.properties b/src/share/demo/nbproject/jfc/TransparentRuler/build.properties
new file mode 100644
index 0000000000..b1b2ef89b8
--- /dev/null
+++ b/src/share/demo/nbproject/jfc/TransparentRuler/build.properties
@@ -0,0 +1,22 @@
+main.dir=${basedir}/../../../jfc/TransparentRuler
+
+src.dir=${main.dir}/src
+
+build.dir=build
+classes.dir=${build.dir}/classes
+jar=${main.dir}/TransparentRuler.jar
+javadoc.dir=${build.dir}/javadoc
+
+build.sysclasspath=ignore
+# E.g.: cp=lib/x.jar:lib/y.jar
+cp=
+extra.run.cp=
+
+main.class=transparentruler.Ruler
+
+run.cp=${cp}:${classes.dir}:${extra.run.cp}
+
+debug=true
+deprecation=false
+
+nbjdk.home=${basedir}/../../../..
diff --git a/src/share/demo/nbproject/jfc/TransparentRuler/build.xml b/src/share/demo/nbproject/jfc/TransparentRuler/build.xml
new file mode 100644
index 0000000000..8db759a30c
--- /dev/null
+++ b/src/share/demo/nbproject/jfc/TransparentRuler/build.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<project name="TransparentRuler" basedir="." default="jar">
+
+ <import file="nbproject/jdk.xml"/>
+
+ <target name="-prop-init">
+ <property file="user.build.properties"/>
+ <property file="build.properties"/>
+ </target>
+
+ <target name="-init" depends="-prop-init,-jdk-init"/>
+
+ <target name="compile" depends="-init" description="Compile main sources.">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ </javac>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile" description="Build JAR file for main sources.">
+ <jar jarfile="${jar}" compress="true">
+ <manifest>
+ <attribute name="Main-Class" value="${main.class}"/>
+ </manifest>
+ <fileset dir="${classes.dir}"/>
+ </jar>
+ </target>
+
+ <target name="run" depends="compile" description="Run application.">
+ <fail unless="main.class">Must set property 'main.class' (e.g. in build.properties)</fail>
+ <java classname="${main.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ </java>
+ </target>
+
+ <target name="javadoc" depends="-init" description="Build Javadoc.">
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc destdir="${javadoc.dir}">
+ <classpath path="${cp}"/>
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <fileset dir="${src.dir}"/>
+ </javadoc>
+ </target>
+
+ <target name="clean" depends="-init" description="Clean build products.">
+ <delete dir="${build.dir}"/>
+ <delete file="${jar}"/>
+ </target>
+
+ <target name="profile">
+ <ant antfile="nbproject/netbeans-targets.xml" target="profile"/>
+ </target>
+
+</project>
diff --git a/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml
new file mode 100644
index 0000000000..9d750841e3
--- /dev/null
+++ b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<project basedir=".." name="TransparentRuler/file">
+
+ <import file="../build.xml"/>
+
+ <target name="compile-selected" depends="-init">
+ <fail unless="includes">Must set property 'includes'</fail>
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" includes="${includes}">
+ <classpath path="${cp}"/>
+ </javac>
+ </target>
+
+</project>
diff --git a/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml
new file mode 100644
index 0000000000..3690ef0e8f
--- /dev/null
+++ b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<project name="jdk" basedir=".">
+
+ <target name="-jdk-preinit">
+ <condition property=".exe" value=".exe">
+ <os family="windows"/>
+ </condition>
+ <property name=".exe" value=""/>
+ <property name="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}"/>
+ <property name="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}"/>
+ <property name="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}"/>
+ <property name="nbjdk.appletviewer" value="${nbjdk.home}/bin/appletviewer${.exe}"/>
+ <property name="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar"/>
+ </target>
+
+ <target name="-jdk-presetdef-basic" depends="-jdk-preinit" unless="nbjdk.presetdef.basic.done">
+ <macrodef name="javac-presetdef">
+ <attribute name="javacval"/>
+ <sequential>
+ <presetdef name="javac">
+ <javac fork="yes" executable="@{javacval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javac-presetdef javacval="${nbjdk.javac}"/>
+ <macrodef name="java-presetdef">
+ <attribute name="javaval"/>
+ <sequential>
+ <presetdef name="java">
+ <java fork="yes" jvm="@{javaval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <java-presetdef javaval="${nbjdk.java}"/>
+ <macrodef name="javadoc-presetdef">
+ <attribute name="javadocval"/>
+ <sequential>
+ <presetdef name="javadoc">
+ <javadoc executable="@{javadocval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
+ <property name="nbjdk.presetdef.basic.done" value="true"/>
+ </target>
+
+ <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" unless="nbjdk.presetdef.nbjpdastart.done">
+ <macrodef name="nbjpdastart-presetdef">
+ <attribute name="bootcpval"/>
+ <sequential>
+ <presetdef name="nbjpdastart">
+ <nbjpdastart>
+ <bootclasspath>
+ <path path="@{bootcpval}"/>
+ </bootclasspath>
+ </nbjpdastart>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
+ <property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
+ </target>
+
+ <target name="-jdk-init" depends="-jdk-preinit,-jdk-presetdef-basic"/>
+
+</project>
diff --git a/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml
new file mode 100644
index 0000000000..84a0e9b3c5
--- /dev/null
+++ b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<project basedir=".." name="TransparentRuler/NB">
+
+ <import file="../build.xml"/>
+
+ <target name="debug" depends="compile,-jdk-presetdef-nbjpdastart">
+ <nbjpdastart addressproperty="jpda.address" name="TransparentRuler" transport="dt_socket">
+ <classpath path="${run.cp}"/>
+ </nbjpdastart>
+ <java classname="${main.class}" failonerror="true" fork="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ </java>
+ </target>
+
+ <target name="debug-fix" depends="-init">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ <include name="${class}.java"/>
+ </javac>
+ <nbjpdareload>
+ <fileset dir="${classes.dir}">
+ <include name="${class}.class"/>
+ </fileset>
+ </nbjpdareload>
+ </target>
+
+ <target name="show-javadoc" depends="javadoc">
+ <nbbrowse file="${javadoc.dir}/index.html"/>
+ </target>
+
+ <target name="profile" depends="compile">
+ <nbprofiledirect>
+ <classpath path="${run.cp}"/>
+ </nbprofiledirect>
+ <property environment="env"/>
+ <java classname="${main.class}" fork="true" failonerror="true" dir="${profiler.session.working.dir}" jvm="${profiler.info.jvm}">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}"/>
+ <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
+ </java>
+ </target>
+
+</project>
diff --git a/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml
new file mode 100644
index 0000000000..ecc07bc52b
--- /dev/null
+++ b/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>TransparentRuler</name>
+ <properties>
+ <property-file>user.build.properties</property-file>
+ <property-file>build.properties</property-file>
+ <property name="nbjdk.bootclasspath">${nbjdk.home}/jre/lib/rt.jar</property>
+ </properties>
+ <folders>
+ <source-folder>
+ <label>JDK Demo</label>
+ <location>${main.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>Sources</label>
+ <type>java</type>
+ <location>${src.dir}</location>
+ </source-folder>
+ <build-folder>
+ <location>${build.dir}</location>
+ </build-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>jar</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>jar</target>
+ </action>
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="javadoc">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-javadoc</target>
+ </action>
+ <action name="debug">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ </action>
+ <action name="compile.single">
+ <script>nbproject/file-targets.xml</script>
+ <target>compile-selected</target>
+ <context>
+ <property>includes</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path</format>
+ <arity>
+ <separated-files>,</separated-files>
+ </arity>
+ </context>
+ </action>
+ <action name="run.single">
+ <target>run</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.single">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.fix">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug-fix</target>
+ <context>
+ <property>class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path-noext</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ </ide-actions>
+ <export>
+ <type>jar</type>
+ <location>${jar}</location>
+ <build-target>jar</build-target>
+ <clean-target>clean</clean-target>
+ </export>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>Sources</label>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-file>
+ <location>${main.dir}/README.txt</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="build"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="clean"/>
+ <ide-action name="javadoc"/>
+ <separator/>
+ <ide-action name="run"/>
+ <ide-action name="debug"/>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
+ <compilation-unit>
+ <package-root>${src.dir}</package-root>
+ <classpath mode="compile">${cp}</classpath>
+ <classpath mode="execute">${run.cp}</classpath>
+ <classpath mode="boot">${nbjdk.bootclasspath}</classpath>
+ <built-to>${classes.dir}</built-to>
+ <built-to>${jar}</built-to>
+ <javadoc-built-to>${javadoc.dir}</javadoc-built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>