public abstract class Window
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Window.EventHandler |
static class |
Window.Level
Available window levels.
|
static class |
Window.State |
private static class |
Window.TrackingRectangle |
private class |
Window.UndecoratedMoveResizeHelper |
Modifier and Type | Field and Description |
---|---|
private float |
alpha |
static int |
CLOSABLE |
private long |
delegatePtr |
private int |
disableCount |
private Timer |
embeddedLocationTimer |
private Window.EventHandler |
eventHandler |
private static Window |
focusedWindow |
private int |
height |
private Window.UndecoratedMoveResizeHelper |
helper |
private boolean |
isDecorated |
private boolean |
isFocusable |
private boolean |
isFocused |
private boolean |
isModal |
private boolean |
isResizable |
private boolean |
isVisible |
private int |
lastKnownEmbeddedX |
private int |
lastKnownEmbeddedY |
private int |
level |
static int |
MAXIMIZABLE |
private int |
maximumHeight |
private int |
maximumWidth |
private MenuBar |
menubar |
static int |
MINIMIZABLE |
private int |
minimumHeight |
private int |
minimumWidth |
static int |
NORMAL
Normal window.
|
private Window |
owner |
private long |
parent |
private float |
platformScale |
static int |
POPUP
A popup window.
|
private long |
ptr |
private float |
renderScale |
static int |
RIGHT_TO_LEFT
Indicates that the window trim will draw from right to left.
|
private Screen |
screen |
private boolean |
shouldStartUndecoratedMove |
private int |
state |
private int |
styleMask |
private java.lang.String |
title |
static int |
TITLED |
static int |
TRANSPARENT |
static int |
UNIFIED
Indicates that a window will have a client area textured the same way as the platform decorations
and will not have a border between decorations and the client area.
|
static int |
UNTITLED |
static int |
UTILITY
An utility window.
|
private View |
view |
private static java.util.LinkedList<Window> |
visibleWindows |
private int |
width |
private int |
x |
private int |
y |
Modifier | Constructor and Description |
---|---|
protected |
Window(long parent)
Constructs a child window of the specified native parent window.
|
protected |
Window(Window owner,
Screen screen,
int styleMask) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
_close(long ptr) |
protected abstract long |
_createChildWindow(long parent) |
protected abstract long |
_createWindow(long ownerPtr,
long screenPtr,
int mask) |
protected abstract void |
_enterModal(long ptr) |
protected abstract void |
_enterModalWithWindow(long dialog,
long window) |
protected abstract void |
_exitModal(long ptr) |
protected abstract int |
_getEmbeddedX(long ptr) |
protected abstract int |
_getEmbeddedY(long ptr) |
protected abstract boolean |
_grabFocus(long ptr) |
protected abstract boolean |
_maximize(long ptr,
boolean maximize,
boolean wasMaximized) |
protected abstract boolean |
_minimize(long ptr,
boolean minimize) |
protected abstract void |
_releaseInput(long ptr) |
protected abstract boolean |
_requestFocus(long ptr,
int event) |
protected abstract void |
_requestInput(long ptr,
java.lang.String text,
int type,
double width,
double height,
double Mxx,
double Mxy,
double Mxz,
double Mxt,
double Myx,
double Myy,
double Myz,
double Myt,
double Mzx,
double Mzy,
double Mzz,
double Mzt) |
protected abstract void |
_setAlpha(long ptr,
float alpha) |
protected abstract boolean |
_setBackground(long ptr,
float r,
float g,
float b) |
protected abstract void |
_setBounds(long ptr,
int x,
int y,
boolean xSet,
boolean ySet,
int w,
int h,
int cw,
int ch,
float xGravity,
float yGravity) |
protected abstract void |
_setCursor(long ptr,
Cursor cursor) |
protected abstract void |
_setEnabled(long ptr,
boolean enabled) |
protected abstract void |
_setFocusable(long ptr,
boolean isFocusable) |
protected abstract void |
_setIcon(long ptr,
Pixels pixels) |
protected abstract void |
_setLevel(long ptr,
int level) |
protected abstract boolean |
_setMaximumSize(long ptr,
int width,
int height) |
protected abstract boolean |
_setMenubar(long ptr,
long menubarPtr) |
protected abstract boolean |
_setMinimumSize(long ptr,
int width,
int height) |
protected abstract boolean |
_setResizable(long ptr,
boolean resizable) |
protected abstract boolean |
_setTitle(long ptr,
java.lang.String title) |
protected abstract boolean |
_setView(long ptr,
View view) |
protected abstract boolean |
_setVisible(long ptr,
boolean visible) |
protected abstract void |
_toBack(long ptr) |
protected abstract void |
_toFront(long ptr) |
protected abstract void |
_ungrabFocus(long ptr) |
protected static void |
add(Window window) |
protected static void |
addFirst(Window window) |
private void |
checkNotClosed() |
private void |
checkScreenLocation() |
void |
close() |
void |
dispatchNpapiEvent(java.util.Map eventInfo)
Only used on Mac when run inside a plugin
|
void |
enterModal()
Enter modal state blocking everything except our window.
|
void |
enterModal(Window window)
Enter modal state only blocking the given window.
|
void |
exitModal() |
float |
getAlpha() |
Window.EventHandler |
getEventHandler() |
static Window |
getFocusedWindow() |
int |
getHeight() |
int |
getLevel() |
int |
getMaximumHeight() |
int |
getMaximumWidth() |
MenuBar |
getMenuBar() |
int |
getMinimumHeight() |
int |
getMinimumWidth() |
long |
getNativeHandle()
This method returns "higher-level" native window handle.
|
long |
getNativeWindow()
This method returns "lowest-level" native window handle
(HWND on Windows, NSWindow on Mac, X11 Window handle on linux-gtk etc.)
|
float |
getOutputScale() |
Window |
getOwner() |
float |
getPlatformScale()
Return the scale used to communicate window locations, sizes, and event
coordinates to/from the platform.
|
long |
getRawHandle()
return the "raw' pointer needed by subclasses to pass to native routines
|
float |
getRenderScale()
Return the scale that should be used to render content on this window.
|
Screen |
getScreen() |
int |
getStyleMask() |
java.lang.String |
getTitle() |
View |
getView() |
int |
getWidth() |
static java.util.List<Window> |
getWindows() |
static java.util.List<Window> |
getWindowsClone() |
int |
getX() |
int |
getY() |
boolean |
grabFocus()
Grabs focus on this window.
|
(package private) boolean |
handleMouseEvent(int type,
int button,
int x,
int y,
int xAbs,
int yAbs)
Mouse event handler for processing programmatical resize/move
(for undecorated windows only).
|
protected void |
handleWindowEvent(long time,
int type) |
private boolean |
isChild() |
boolean |
isClosed() |
boolean |
isDecorated() |
boolean |
isEnabled() |
boolean |
isFocused() |
private boolean |
isInFullscreen() |
boolean |
isMaximized() |
boolean |
isMinimized() |
boolean |
isModal() |
boolean |
isResizable() |
boolean |
isTransparentWindow() |
boolean |
isUnifiedWindow() |
boolean |
isVisible() |
boolean |
maximize(boolean maximize) |
boolean |
minimize(boolean minimize) |
protected void |
notifyClose() |
protected void |
notifyDelegatePtr(long ptr) |
protected void |
notifyDestroy() |
protected void |
notifyFocus(int event) |
protected void |
notifyFocusDisabled() |
protected void |
notifyFocusUngrab() |
(package private) void |
notifyFullscreen(boolean entered) |
protected void |
notifyLevelChanged(int level) |
protected void |
notifyMove(int x,
int y) |
protected void |
notifyMoveToAnotherScreen(Screen newScreen) |
protected void |
notifyResize(int type,
int width,
int height)
type values:
- WindowEvent.RESIZE
- WindowEvent.MINIMIZE
- WindowEvent.MAXIMIZE
- WindowEvent.RESTORE
|
void |
releaseInput()
Native keyboard for text input is no longer necessary.
|
protected static void |
remove(Window window) |
boolean |
requestFocus() |
boolean |
requestFocus(int event)
Requests or resigns focus on this window.
|
void |
requestInput(java.lang.String text,
int type,
double width,
double height,
double Mxx,
double Mxy,
double Mxz,
double Mxt,
double Myx,
double Myy,
double Myz,
double Myt,
double Mzx,
double Mzy,
double Mzz,
double Mzt)
Requests text input in form of native keyboard for text component
contained by this Window.
|
void |
setAlpha(float alpha)
Sets the uniform translucency level for this window.
|
boolean |
setBackground(float r,
float g,
float b)
Set the background of the window.
|
void |
setBounds(int x,
int y,
boolean xSet,
boolean ySet,
int w,
int h,
int cw,
int ch,
float xGravity,
float yGravity)
Sets the window bounds to the specified values.
|
void |
setContentSize(int cw,
int ch) |
void |
setCursor(Cursor cursor)
Sets given cursor as the cursor for this window.
|
void |
setEnabled(boolean enabled)
Enables or disables the window.
|
void |
setEventHandler(Window.EventHandler eventHandler) |
void |
setFocusable(boolean isFocusable)
Sets whether this window is focusable.
|
private static void |
setFocusedWindow(Window window) |
void |
setIcon(Pixels pixels) |
void |
setLevel(int level)
Set the level of this window in the z-order.
|
void |
setMaximumSize(int width,
int height)
Sets the maximum size for this window.
|
void |
setMenuBar(MenuBar menubar) |
void |
setMinimumSize(int width,
int height)
Sets the minimum size for this window.
|
void |
setPlatformScale(float platformScale) |
void |
setPosition(int x,
int y) |
void |
setRenderScale(float renderScale) |
boolean |
setResizable(boolean resizable) |
protected void |
setScreen(Screen screen) |
void |
setShouldStartUndecoratedMove(boolean v)
Enables unconditional start of window move operation when
mouse is dragged in the client area.
|
void |
setSize(int w,
int h) |
protected void |
setState(int state) |
void |
setTitle(java.lang.String title) |
void |
setUndecoratedMoveRectangle(int size)
Sets "programmatical move" rectangle.
|
void |
setUndecoratedResizeRectangle(int size)
Sets "programmatical resize" rectangle.
|
void |
setView(View view) |
void |
setVisible(boolean visible) |
boolean |
shouldStartUndecoratedMove(int x,
int y)
The method called only for undecorated windows
x, y: mouse coordinates (in View space).
|
boolean |
shouldStartUndecoratedResize(int x,
int y)
The method called only for undecorated windows
x, y: mouse coordinates (in View space).
|
private void |
synthesizeViewMoveEvent()
Generates a ViewEvent.MOVE aka insets (might have) changed.
|
void |
toBack()
Send the window to the bottom of the stacking order.
|
void |
toFront()
Bring the window to front in the z-order.
|
java.lang.String |
toString() |
void |
ungrabFocus()
Manually ungrabs focus grabbed on this window previously.
|
private long ptr
private volatile long delegatePtr
private static final java.util.LinkedList<Window> visibleWindows
public static final int UNTITLED
public static final int TITLED
public static final int TRANSPARENT
public static final int NORMAL
public static final int UTILITY
public static final int POPUP
public static final int CLOSABLE
public static final int MINIMIZABLE
public static final int MAXIMIZABLE
public static final int RIGHT_TO_LEFT
public static final int UNIFIED
Application.supportsUnifiedWindows()
private final Window owner
private final long parent
private final int styleMask
private final boolean isDecorated
private boolean shouldStartUndecoratedMove
private View view
private Screen screen
private MenuBar menubar
private java.lang.String title
private Window.UndecoratedMoveResizeHelper helper
private int state
private int level
private int x
private int y
private int width
private int height
private float alpha
private float platformScale
private float renderScale
private Timer embeddedLocationTimer
private int lastKnownEmbeddedX
private int lastKnownEmbeddedY
private volatile boolean isResizable
private volatile boolean isVisible
private volatile boolean isFocused
private volatile boolean isFocusable
private volatile boolean isModal
private volatile int disableCount
private int minimumWidth
private int minimumHeight
private int maximumWidth
private int maximumHeight
private Window.EventHandler eventHandler
private static volatile Window focusedWindow
protected Window(long parent)
public static java.util.List<Window> getWindows()
public static java.util.List<Window> getWindowsClone()
protected static void add(Window window)
protected static void addFirst(Window window)
protected static void remove(Window window)
protected abstract long _createWindow(long ownerPtr, long screenPtr, int mask)
protected abstract long _createChildWindow(long parent)
public boolean isClosed()
private void checkNotClosed()
protected abstract boolean _close(long ptr)
public void close()
private boolean isChild()
public long getNativeWindow()
public long getNativeHandle()
public long getRawHandle()
public Window getOwner()
public View getView()
protected abstract boolean _setView(long ptr, View view)
public void setView(View view)
public Screen getScreen()
protected void setScreen(Screen screen)
public int getStyleMask()
public MenuBar getMenuBar()
protected abstract boolean _setMenubar(long ptr, long menubarPtr)
public void setMenuBar(MenuBar menubar)
public boolean isDecorated()
public boolean isMinimized()
protected abstract boolean _minimize(long ptr, boolean minimize)
public boolean minimize(boolean minimize)
public boolean isMaximized()
protected abstract boolean _maximize(long ptr, boolean maximize, boolean wasMaximized)
public boolean maximize(boolean maximize)
public void setPlatformScale(float platformScale)
public final float getPlatformScale()
public void setRenderScale(float renderScale)
public final float getRenderScale()
public float getOutputScale()
protected abstract int _getEmbeddedX(long ptr)
protected abstract int _getEmbeddedY(long ptr)
private void checkScreenLocation()
public int getX()
public int getY()
public int getWidth()
public int getHeight()
protected abstract void _setBounds(long ptr, int x, int y, boolean xSet, boolean ySet, int w, int h, int cw, int ch, float xGravity, float yGravity)
public void setBounds(int x, int y, boolean xSet, boolean ySet, int w, int h, int cw, int ch, float xGravity, float yGravity)
x -= xGravity * deltaW
y -= yGravity * deltaH
x
- the new window horizontal position, ignored if xSet is set to
falsey
- the new window vertical position, ignored if ySet is set to
falsexSet
- indicates whether the x parameter is validySet
- indicates whether the y parameter is validw
- the new window width, ignored if set to -1h
- the new window height, ignored if set to -1cw
- the new window content width, ignored if set to -1ch
- the new window content height, ignored if set to -1xGravity
- the xGravity coefficientyGravity
- the yGravity coefficientpublic void setPosition(int x, int y)
public void setSize(int w, int h)
public void setContentSize(int cw, int ch)
public boolean isVisible()
private void synthesizeViewMoveEvent()
protected abstract boolean _setVisible(long ptr, boolean visible)
public void setVisible(boolean visible)
protected abstract boolean _setResizable(long ptr, boolean resizable)
public boolean setResizable(boolean resizable)
public boolean isResizable()
public boolean isUnifiedWindow()
public boolean isTransparentWindow()
public static Window getFocusedWindow()
private static void setFocusedWindow(Window window)
public boolean isFocused()
protected abstract boolean _requestFocus(long ptr, int event)
public boolean requestFocus(int event)
event
argument is WindowEvent.FOCUS_GAINED.
Otherwise, if the window is a child window, the argument may be
WindowEvent.FOCUS_LOST, FOCUS_GAINED, FOCUS_GAINED_FORWARD, or
FOCUS_GAINED_BACKWARD.event
- one of WindowEvent.FOCUS_LOST, FOCUS_GAINED, FOCUS_GAINED_FORWARD, FOCUS_GAINED_BACKWARDtrue
if the operation succeededjava.lang.IllegalArgumentException
- if the argument value is invalid for this windowpublic boolean requestFocus()
protected abstract void _setFocusable(long ptr, boolean isFocusable)
public void setFocusable(boolean isFocusable)
protected abstract boolean _grabFocus(long ptr)
protected abstract void _ungrabFocus(long ptr)
public boolean grabFocus()
setFocusable(boolean)
). Clicking a focusable owned
window will reset the grab due to a focus transfer.
The click that occurs in another window and causes resetting of the grab
may or may not be delivered to that other window depending on the native
OS behavior.
If any of the application's windows already holds the grab, it is reset
prior to grabbing the focus for this window. The method may be called
multiple times for one window. Subsequent calls do not affect the grab
status unless it is reset between the calls, in which case the focus
is grabbed again.
Note that grabbing the focus on an application window may prevent
delivering certain events to other applications until the grab is reset.
Therefore, if the application has finished showing popup windows based
on a user action (e.g. clicking a menu item), and doesn't require the
grab any more, it should call the ungrabFocus()
method. The
FOCUS_UNGRAB event signals that the grab has been reset.
A user event handler associated with a menu item must be invoked after
resetting the grab. Otherwise, if a developer debugs the application and
has installed a breakpoint in the event handler, the debugger may become
unoperable due to events blocking for other applications on some
platforms.true
if the operation is successfuljava.lang.IllegalStateException
- if the window isn't focused currentlypublic void ungrabFocus()
grabFocus()
public java.lang.String getTitle()
protected abstract boolean _setTitle(long ptr, java.lang.String title)
public void setTitle(java.lang.String title)
protected abstract void _setLevel(long ptr, int level)
public void setLevel(int level)
level
- one of the constants from Window.Level
Window.Level
public int getLevel()
private boolean isInFullscreen()
void notifyFullscreen(boolean entered)
protected abstract void _setAlpha(long ptr, float alpha)
public void setAlpha(float alpha)
alpha
- a value in the range [0..1f] (transparent..fully-opaque)public float getAlpha()
protected abstract boolean _setBackground(long ptr, float r, float g, float b)
public boolean setBackground(float r, float g, float b)
public boolean isEnabled()
protected abstract void _setEnabled(long ptr, boolean enabled)
public void setEnabled(boolean enabled)
public int getMinimumWidth()
public int getMinimumHeight()
public int getMaximumWidth()
public int getMaximumHeight()
protected abstract boolean _setMinimumSize(long ptr, int width, int height)
public void setMinimumSize(int width, int height)
java.lang.IllegalArgumentException
- if width or height < 0protected abstract boolean _setMaximumSize(long ptr, int width, int height)
public void setMaximumSize(int width, int height)
Integer.MAX_VALUE
indicates no restriction.
If the native platform is unable to apply the constraints,
the values returned by getMaximumWidth()/Height() won't change.java.lang.IllegalArgumentException
- if width or height < 0protected abstract void _setIcon(long ptr, Pixels pixels)
public void setIcon(Pixels pixels)
protected abstract void _setCursor(long ptr, Cursor cursor)
public void setCursor(Cursor cursor)
Cursor.setVisible(boolean)
protected abstract void _toFront(long ptr)
public void toFront()
protected abstract void _toBack(long ptr)
public void toBack()
protected abstract void _enterModal(long ptr)
public void enterModal()
protected abstract void _enterModalWithWindow(long dialog, long window)
public void enterModal(Window window)
protected abstract void _exitModal(long ptr)
public void exitModal()
public boolean isModal()
public void dispatchNpapiEvent(java.util.Map eventInfo)
public Window.EventHandler getEventHandler()
public void setEventHandler(Window.EventHandler eventHandler)
public void setShouldStartUndecoratedMove(boolean v)
protected void notifyClose()
protected void notifyDestroy()
protected void notifyMove(int x, int y)
protected void notifyMoveToAnotherScreen(Screen newScreen)
protected void setState(int state)
protected void notifyResize(int type, int width, int height)
protected void notifyFocus(int event)
protected void notifyFocusDisabled()
protected void notifyFocusUngrab()
protected void notifyDelegatePtr(long ptr)
protected void handleWindowEvent(long time, int type)
public void setUndecoratedMoveRectangle(int size)
public boolean shouldStartUndecoratedMove(int x, int y)
public void setUndecoratedResizeRectangle(int size)
public boolean shouldStartUndecoratedResize(int x, int y)
boolean handleMouseEvent(int type, int button, int x, int y, int xAbs, int yAbs)
public java.lang.String toString()
toString
in class java.lang.Object
protected void notifyLevelChanged(int level)
public void requestInput(java.lang.String text, int type, double width, double height, double Mxx, double Mxy, double Mxz, double Mxt, double Myx, double Myy, double Myz, double Myt, double Mzx, double Mzy, double Mzz, double Mzt)
text
- text to be shown in the native text input componenttype
- type of text input component @see com.sun.javafx.scene.control.behavior.TextInputTypeswidth
- width of JavaFX text input componentheight
- height of JavaFX text input componentM
- standard transformation matrix for drawing the native text component derived from JavaFX componentpublic void releaseInput()
protected abstract void _requestInput(long ptr, java.lang.String text, int type, double width, double height, double Mxx, double Mxy, double Mxz, double Mxt, double Myx, double Myy, double Myz, double Myt, double Mzx, double Mzy, double Mzz, double Mzt)
protected abstract void _releaseInput(long ptr)