Top Description Inners Fields Methods
com.jogamp.newt

public Interface Window

extends NativeWindow, WindowClosingProtocol, ScalableSurface
Known Direct Implementers
com.jogamp.newt.opengl.GLWindow, jogamp.newt.WindowImpl
Imports
java.util.List, com.jogamp.newt.Display.PointerIcon, com.jogamp.newt.event.GestureHandler, .WindowEvent, .WindowListener, .KeyListener, .KeyEvent, .InputEvent, .MouseListener, jogamp.newt.Debug, .WindowImpl, com.jogamp.nativewindow.CapabilitiesChooser, .CapabilitiesImmutable, .NativeWindow, .ScalableSurface, .WindowClosingProtocol, com.jogamp.nativewindow.util.Rectangle, .RectangleImmutable, .SurfaceSize

Specifying NEWT's Window functionality:

One use case is com.jogamp.newt.opengl.GLWindow, which delegates window operation to an instance of this interface while providing OpenGL functionality.

All values of this interface are represented in window units, if not stated otherwise.

Coordinate System

See NativeWindow and Screen.

Custom Window Icons

Custom window icons can be defined via system property newt.window.icons, which shall contain a list of PNG icon locations from low- to high-resolution, separated by one whitespace or one comma character. The location must be resolvable via classpath, i.e. shall reference a location within the jar file. Example (our default):

  -Dnewt.window.icons="newt/data/jogamp-16x16.png,newt/data/jogamp-32x32.png"
  -Djnlp.newt.window.icons="newt/data/jogamp-16x16.png,newt/data/jogamp-32x32.png"
The property can also be set programmatically, which must happen before any NEWT classes are touched:
  System.setProperty("newt.window.icons", "newt/data/jogamp-16x16.png, newt/data/jogamp-32x32.png");
To disable even Jogamp's own window icons in favor of system icons, simply set a non-existing location, e.g.:
  -Dnewt.window.icons="null,null"

Use of Lifecycle Heavy functions

Some of the methods specified here are lifecycle-heavy. That is, they are able to destroy and/or reattach resources to/from the window. Because of this, the methods are not safe to be called from EDT related threads. For example, it is not safe for a method in an attached KeyListener to call setFullscreen(boolean) on a Window directly. It is safe, however, for that method to spawn a background worker thread which calls the method directly. The documentation for individual methods indicates whether or not they are lifecycle-heavy.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static enum
Window.ReparentOperation

Reparenting operation types

Field Summary

Modifier and TypeField and Description
public static final boolean
public static final boolean
public static final boolean
public static final int
REPARENT_HINT_BECOMES_VISIBLE

Reparenting hint (bitfield value): Claim window becomes visible after reparenting, which is important for e.g. preserving the GL-states in case window is invisible while reparenting.

public static final int
REPARENT_HINT_FORCE_RECREATION

Reparenting hint (bitfield value): Force destroy and hence re-creating the window.

public static final int
STATE_BIT_ALWAYSONBOTTOM

Set if window is always on bottom, otherwise cleared.

public static final int
STATE_BIT_ALWAYSONTOP

Set if window is always on top, otherwise cleared.

public static final int
STATE_BIT_AUTOPOSITION

Hinting that no custom position has been set before first visibility of this instance.

public static final int
STATE_BIT_CHILDWIN

Set if window is a child window, i.e. has been reparented.

public static final int
STATE_BIT_FOCUSED

Set if window has the input focus, otherwise cleared.

public static final int
STATE_BIT_FULLSCREEN

Set if window is in fullscreen mode, otherwise cleared.

public static final int
STATE_BIT_MAXIMIZED_HORZ

Set if window is maximized horizontally, otherwise cleared.

public static final int
STATE_BIT_MAXIMIZED_VERT

Set if window is maximized vertically, otherwise cleared.

public static final int
STATE_BIT_POINTERCONFINED

Set if the pointer is confined to the window, otherwise cleared.

public static final int
STATE_BIT_POINTERVISIBLE

Set if the pointer is visible when inside the window, otherwise cleared.

public static final int
STATE_BIT_RESIZABLE

Set if window is resizable, otherwise cleared.

public static final int
STATE_BIT_STICKY

Set if window is sticky, i.e. visible on all virtual desktop, otherwise cleared.

public static final int
STATE_BIT_UNDECORATED

Set if window has window decorations, otherwise cleared.

public static final int
STATE_BIT_VISIBLE

Visibility of this instance.

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final long
TIMEOUT_NATIVEWINDOW

A 1s timeout while waiting for a native action response, ie setVisible(boolean).

Inherited from com.jogamp.nativewindow.ScalableSurface:
AUTOMAX_PIXELSCALEIDENTITY_PIXELSCALE

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
addGestureHandler(GestureHandler gh)

Appends the given GestureHandler to the end of the list.

public void
addGestureHandler(int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
GestureHandler
The listener object to be inserted
gh
)

Inserts the given GestureHandler at the specified position in the list.

public void
public void
addGestureListener(int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
GestureHandler.GestureListener
The listener object to be inserted
gl
)

Inserts the given GestureHandler.GestureListener at the specified position in the list.

public void
addKeyListener(KeyListener l)

Appends the given com.jogamp.newt.event.KeyListener to the end of the list.

public void
addKeyListener(int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
KeyListener
The listener object to be inserted
l
)

Inserts the given com.jogamp.newt.event.KeyListener at the specified position in the list.

public void
addMouseListener(MouseListener l)

Appends the given MouseListener to the end of the list.

public void
addMouseListener(int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
MouseListener
The listener object to be inserted
l
)

Inserts the given MouseListener at the specified position in the list.

public void
addWindowListener(WindowListener l)

Appends the given com.jogamp.newt.event.WindowListener to the end of the list.

public void
addWindowListener(int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
WindowListener
The listener object to be inserted
l
)

Inserts the given com.jogamp.newt.event.WindowListener at the specified position in the list.

public boolean
areDefaultGesturesEnabled()

Return true if default GestureHandler are enabled.

public void
confinePointer(boolean
defaults to false.
confine
)

Confine the pointer to this window, ie.

public void
destroy()

Redeclares com.jogamp.nativewindow.NativeWindow.destroy.

Destroys this window incl.
public void
enqueueEvent(boolean
Passing true will block until the event has been processed, otherwise method returns immediately.
wait
,
NEWTEvent
The event to enqueue.
event
)

Enqueues a NEWT event.

public Rectangle
getBounds()

Returns a newly created Rectangle containing window origin, getX() & getY(), and size, getWidth() & getHeight(), in window units.

public CapabilitiesImmutable

Returns:

the chosen capabilities
getChosenCapabilities
()

Gets an immutable set of chosen capabilities.

public Window
getDelegatedWindow()

If the implementation uses delegation, return the delegated Window instance, otherwise return this instance.

public KeyListener
getKeyListener(int index)

public KeyListener[]
public MonitorDevice
getMainMonitor()

Returns the MonitorDevice with the highest viewport coverage of this window.

public MouseListener
getMouseListener(int index)

Returns the MouseListener from the list at the given index.

public MouseListener[]
public float[]

Returns:

the passed storage containing the ppmm for chaining
getPixelsPerMM
(final float[]
float[2] storage for the ppmm result
ppmmStore
)

Returns the pixels per millimeter of this window's NativeSurface according to the main monitor's current mode's surface resolution.

public Display.PointerIcon
getPointerIcon()

Returns the current PointerIcon, which maybe null for the default.

public CapabilitiesImmutable

Returns:

the requested capabilities
getRequestedCapabilities
()

Gets an immutable set of requested capabilities.

public Screen

Returns:

The associated Screen
getScreen
()

public int
getStateMask()

Returns the current status mask of this instance.

public String
getStateMaskString()

Returns a string representation of the current state mask.

public int
getStatePublicBitCount()

Number of all public state bits.

public int
getStatePublicBitmask()

Bitmask covering all public state bits.

public int
getSupportedStateMask()

Returns the supported state mask of the implementation.

public String
getSupportedStateMaskString()

Returns a string representation of the supported state mask.

public String
public WindowListener
getWindowListener(int index)

public WindowListener[]
public boolean
public boolean
public boolean
isChildWindow()

Returns true if this window is a child window, i.e. has been reparented.

public boolean
public boolean
isKeyboardVisible()

Return true if the virtual on-screen keyboard is visible, otherwise false.

public boolean
public boolean
public boolean

Returns:

true if the native window handle is valid and ready to operate, ie if the native window has been created via setVisible(true), otherwise false.
isNativeValid
()

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public void
removeGestureHandler(GestureHandler gh)

Removes the given GestureHandler from the list.

public void
public void
public void
removeMouseListener(MouseListener l)

Removes the given MouseListener from the list.

public void
public Window.ReparentOperation

Returns:

The issued reparent action type (strategy) as defined in Window.ReparentAction
reparentWindow
(NativeWindow
The new parent NativeWindow. If null, this Window becomes a top level window.
newParent
,
int
new top-level position in window units, use -1 for default position.
x
,
int
new top-level position in window units, use -1 for default position.
y
,
int
May contain hints (bitfield values) like REPARENT_HINT_FORCE_RECREATION or REPARENT_HINT_BECOMES_VISIBLE.
hints
)

Change this window's parent window.

public void
requestFocus()

Request focus for this native window

The request is handled on this Window EDT and blocked until finished.

public void
requestFocus(boolean
true if waiting until the request is executed, otherwise false
wait
)

Request focus for this native window

The request is handled on this Window EDT.

public void
runOnEDTIfAvail(boolean wait, final Runnable task)

public void
public void
setAlwaysOnBottom(boolean value)

Operation is ignored if this instance is a child window.

public void
setAlwaysOnTop(boolean value)

Operation is ignored if this instance is a child window.

public CapabilitiesChooser

Returns:

the previous CapabilitiesChooser
setCapabilitiesChooser
(CapabilitiesChooser
the new CapabilitiesChooser
chooser
)

Set the CapabilitiesChooser to help determine the native visual type.

public void
setDefaultGesturesEnabled(boolean enable)

Enable or disable default GestureHandler.

public void
setFocusAction(Window.FocusRunnable focusAction)

Sets a FocusRunnable, which FocusRunnable#run() method is executed before the native focus is requested.

public boolean

Returns:

success
setFullscreen
(boolean
enable or disable fullscreen mode
fullscreen
)

Enable or disable fullscreen mode for this window.

public boolean

Returns:

success
setFullscreen
(List<MonitorDevice>
if null fullscreen will be spanned across all MonitorDevices, otherwise across the given list of MonitorDevice.
monitors
)

Enable fullscreen mode for this window spanning across the given MonitorDevices or across all MonitorDevices.

public void
setKeyboardFocusHandler(KeyListener l)

Sets a KeyListener allowing focus traversal with a covered window toolkit like AWT.

public void
setKeyboardVisible(boolean visible)

In case the platform supports or even requires a virtual on-screen keyboard, this method shows or hide it depending on whether visible is true or false.

public void
setMaximized(final boolean horz, final boolean vert)

Operation is ignored if this instance is a child window.

public void
setPointerIcon(final Display.PointerIcon
Valid PointerIcon reference or null to reset the pointer icon to default.
pi
)

public void
setPointerVisible(boolean
defaults to true for platforms w/ visible pointer, otherwise defaults to true, eg. Android.
pointerVisible
)

Makes the pointer visible or invisible.

public void
setPosition(int
coord of the client-area's top left corner in window units
x
,
int
coord of the client-area's top left corner in window units
y
)

Sets the location of the window's client area excluding insets (window decorations) in window units.

public void
setResizable(final boolean value)

Operation is ignored if this instance is a child window.

public void
setSize(int
of the window's client area in window units
width
,
int
of the window's client area in window units
height
)

Sets the size of the window's client area in window units, excluding decorations.

public void
setSticky(final boolean value)

Operation is ignored if this instance is a child window.

public void
setSurfaceSize(int
of the window's client area in pixel units
pixelWidth
,
int
of the window's client area in pixel units
pixelHeight
)

Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations.

public void
public void
setTopLevelPosition(int
coord of the top-level left corner in window units
x
,
int
coord of the top-level left corner in window units
y
)

Sets the location of the top-level window inclusive insets (window decorations) in window units.

public void
setTopLevelSize(int
of the top-level window area in window units
width
,
int
of the top-level window area in window units
height
)

Sets the size of the top-level window including insets (window decorations) in window units.

public void
setUndecorated(boolean value)

public void
setVisible(boolean visible)

Calls setVisible(true, visible), i.e. blocks until the window becomes visible.

public void
setVisible(boolean wait, boolean visible)

setVisible(..) makes the window and children visible if visible is true, otherwise the window and children becomes invisible.

public void
setWindowDestroyNotifyAction(Runnable r)

Set a custom action handling destruction issued by a toolkit triggered window destroy replacing the default destroy() action.

public void
warpPointer(int
relative pointer x position within this window in pixel units
x
,
int
relative pointer y position within this window in pixel units
y
)

Moves the pointer to x/y relative to this window's origin in pixel units.

public void
windowRepaint(int
dirty-region y-pos in pixel units
x
,
int
dirty-region x-pos in pixel units
y
,
int
dirty-region width in pixel units
width
,
int
dirty-region height in pixel units
height
)

Trigger window repaint while passing the dirty region in pixel units.

Inherited from com.jogamp.nativewindow.NativeWindow:
getHeightgetInsetsgetLocationOnScreengetNativeSurfacegetParentgetWidthgetWindowHandlegetXgetYhasFocus
Inherited from com.jogamp.nativewindow.ScalableSurface:
getCurrentSurfaceScalegetMaximumSurfaceScalegetMinimumSurfaceScalegetRequestedSurfaceScalesetSurfaceScale
Inherited from com.jogamp.nativewindow.WindowClosingProtocol:
getDefaultCloseOperationsetDefaultCloseOperation