aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com')
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java35
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/NewtFactory.java4
-rwxr-xr-xsrc/classes/com/sun/javafx/newt/Window.java26
-rw-r--r--src/classes/com/sun/javafx/newt/awt/AWTWindow.java19
4 files changed, 78 insertions, 6 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java
index 7f7d8d077..d66de7149 100644
--- a/src/classes/com/sun/javafx/newt/GLWindow.java
+++ b/src/classes/com/sun/javafx/newt/GLWindow.java
@@ -89,23 +89,36 @@ public class GLWindow extends Window implements GLAutoDrawable {
return create(null, null);
}
+ public static GLWindow create(boolean undecorated) {
+ return create(null, null, undecorated);
+ }
+
/** Creates a new GLWindow referring to the given window. */
public static GLWindow create(Window window) {
return create(window, null);
}
+ public static GLWindow create(GLCapabilities caps) {
+ return create(caps, false);
+ }
/** Creates a new GLWindow on the local display, screen 0, with a
dummy visual ID, and with the given GLCapabilities. */
- public static GLWindow create(GLCapabilities caps) {
- return create(null, caps);
+ public static GLWindow create(GLCapabilities caps, boolean undecorated) {
+ return create(null, caps, undecorated);
}
/** Creates a new GLWindow referring to the given window, and with the given GLCapabilities. */
public static GLWindow create(Window window, GLCapabilities caps) {
+ return create(window, caps, false);
+ }
+
+ public static GLWindow create(Window window,
+ GLCapabilities caps,
+ boolean undecorated) {
if (window == null) {
Display display = NewtFactory.createDisplay(null); // local display
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
- window = NewtFactory.createWindow(screen, 0); // dummy VisualID
+ window = NewtFactory.createWindow(screen, 0, undecorated); // dummy VisualID
}
if (caps == null) {
caps = new GLCapabilities();
@@ -230,6 +243,22 @@ public class GLWindow extends Window implements GLAutoDrawable {
}
}
+ public void setTitle(String title) {
+ window.setTitle(title);
+ }
+
+ public String getTitle() {
+ return window.getTitle();
+ }
+
+ public void setUndecorated(boolean value) {
+ window.setUndecorated(value);
+ }
+
+ public boolean isUndecorated() {
+ return window.isUndecorated();
+ }
+
public void setSize(int width, int height) {
window.setSize(width, height);
}
diff --git a/src/classes/com/sun/javafx/newt/NewtFactory.java b/src/classes/com/sun/javafx/newt/NewtFactory.java
index feb623caa..6f6eeb02d 100755
--- a/src/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/classes/com/sun/javafx/newt/NewtFactory.java
@@ -106,6 +106,10 @@ public abstract class NewtFactory {
return Window.create(getWindowType(), screen, visualID);
}
+ public static Window createWindow(Screen screen, long visualID, boolean undecorated) {
+ return Window.create(getWindowType(), screen, visualID, undecorated);
+ }
+
/**
* Create a Window entity using the given implementation type, incl native creation
*/
diff --git a/src/classes/com/sun/javafx/newt/Window.java b/src/classes/com/sun/javafx/newt/Window.java
index 35d358b53..3601b87a9 100755
--- a/src/classes/com/sun/javafx/newt/Window.java
+++ b/src/classes/com/sun/javafx/newt/Window.java
@@ -65,12 +65,17 @@ public abstract class Window implements NativeWindow
}
protected static Window create(String type, Screen screen, long visualID) {
+ return create(type, screen, visualID, false);
+ }
+
+ protected static Window create(String type, Screen screen, long visualID, boolean undecorated) {
try {
Class windowClass = getWindowClass(type);
Window window = (Window) windowClass.newInstance();
window.invalidate();
window.screen = screen;
window.visualID = visualID;
+ window.setUndecorated(undecorated);
window.createNative();
return window;
} catch (Throwable t) {
@@ -159,6 +164,27 @@ public abstract class Window implements NativeWindow
protected int width, height, x, y;
protected int eventMask;
+ protected String title = "AWT NewtWindow";
+ protected boolean undecorated = false;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public void setUndecorated(boolean value) {
+ undecorated = value;
+ }
+
+ public boolean isUndecorated() {
+ return undecorated;
+ }
+
+
+
//
// NativeWindow impl
//
diff --git a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java
index 780d7f488..0f5b1df6f 100644
--- a/src/classes/com/sun/javafx/newt/awt/AWTWindow.java
+++ b/src/classes/com/sun/javafx/newt/awt/AWTWindow.java
@@ -50,7 +50,7 @@ import com.sun.javafx.newt.Window;
supporting Java SE. */
public class AWTWindow extends Window {
- private Frame frame;
+ private javax.swing.JFrame frame;
private Canvas canvas;
private LinkedList/*<AWTEventWrapper>*/ events = new LinkedList();
private boolean gotDisplaySize;
@@ -61,18 +61,31 @@ public class AWTWindow extends Window {
return false;
}
+ public void setTitle(String title) {
+ super.setTitle(title);
+ if (frame != null) {
+ frame.setTitle(title);
+ }
+ }
+
protected void createNative() {
runOnEDT(new Runnable() {
public void run() {
- frame = new Frame("AWT NewtWindow");
+ frame = new javax.swing.JFrame(getTitle());
+ frame.setUndecorated(isUndecorated());
+ if (isUndecorated()) {
+ frame.setBackground(new java.awt.Color(0, 0, 0, 0));
+ frame.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);
+ }
frame.setLayout(new BorderLayout());
canvas = new Canvas();
+ canvas.setBackground(new java.awt.Color(0, 0, 0, 0));
Listener listener = new Listener();
canvas.addMouseListener(listener);
canvas.addMouseMotionListener(listener);
canvas.addKeyListener(listener);
canvas.addComponentListener(listener);
- frame.add(canvas, BorderLayout.CENTER);
+ frame.getContentPane().add(canvas);//add(canvas, BorderLayout.CENTER);
frame.setSize(width, height);
frame.setLocation(x, y);
frame.addComponentListener(new MoveListener());