Class NewtFactory
- java.lang.Object
-
- com.jogamp.newt.NewtFactory
-
public class NewtFactory extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG_IMPLEMENTATION
static String
DRIVER_DEFAULT_ROOT_PACKAGE
-
Constructor Summary
Constructors Constructor Description NewtFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Screen
createCompatibleScreen(NativeWindow parent)
static Screen
createCompatibleScreen(NativeWindow parent, Screen childScreen)
static Display
createDisplay(String name)
Create a Display entity.static Display
createDisplay(String name, boolean reuse)
Create a Display entity.static Display
createDisplay(String type, long handle, boolean reuse)
Instantiate a Display entity using the native handle.static Display
createDisplay(String type, String name)
Create a Display entity.static Display
createDisplay(String type, String name, boolean reuse)
Create a Display entity.static Screen
createScreen(Display display, int index)
Create a Screen entity.static Window
createWindow(CapabilitiesImmutable caps)
Create a top level Window entity on the default Display and default Screen.static Window
createWindow(NativeWindow parentWindow, CapabilitiesImmutable caps)
Create a child Window entity attached to the given parent.
The Screen and Display information is regenerated utilizing the parents information, while reusing an existing Display.static Window
createWindow(Screen screen, CapabilitiesImmutable caps)
Create a top level Window entity.static Window
createWindow(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps)
Ability to try a Window type with a constructor argument, if supported ..static Window
createWindow(String displayConnection, int screenIdx, long parentWindowHandle, CapabilitiesImmutable caps)
Create a child Window entity attached to the given parent, incl native creationstatic Class<?>
getCustomClass(String packageName, String classBaseName)
static IOUtil.ClassResources
getWindowIcons()
Returns the application window icon resources to be used.static boolean
isScreenCompatible(NativeWindow parent, Screen childScreen)
static void
setUseEDT(boolean onoff)
Toggles the usage of an EventDispatchThread while creating a Display.
The default is enabled.
The EventDispatchThread is thread local to the Display instance.static void
setWindowIcons(IOUtil.ClassResources cres)
Allow user to set custom window icons, only applicable at application start before creating any NEWT instance.static boolean
useEDT()
-
-
-
Field Detail
-
DEBUG_IMPLEMENTATION
public static final boolean DEBUG_IMPLEMENTATION
-
DRIVER_DEFAULT_ROOT_PACKAGE
public static final String DRIVER_DEFAULT_ROOT_PACKAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getWindowIcons
public static IOUtil.ClassResources getWindowIcons()
Returns the application window icon resources to be used.Property
newt.window.icons
may define a list of PNG icons separated by one whitespace or one comma character. Shall reference at least two PNG icons, from lower (16x16) to higher (>= 32x32) resolution.Users may also specify application window icons using
setWindowIcons(com.jogamp.common.util.IOUtil.ClassResources)
.
-
setWindowIcons
public static void setWindowIcons(IOUtil.ClassResources cres)
Allow user to set custom window icons, only applicable at application start before creating any NEWT instance.Shall reference at least two PNG icons, from lower (16x16) to higher (>= 32x32) resolution.
-
setUseEDT
public static void setUseEDT(boolean onoff)
Toggles the usage of an EventDispatchThread while creating a Display.
The default is enabled.
The EventDispatchThread is thread local to the Display instance.
-
useEDT
public static boolean useEDT()
- See Also:
setUseEDT(boolean)
-
createDisplay
public static Display createDisplay(String name)
Create a Display entity.Native creation is lazily done at usage, ie.
Display.addReference()
.An already existing display connection of the same
name
will be reused.- Parameters:
name
- the display connection name which is a technical platform specific detail, seeAbstractGraphicsDevice.getConnection()
. Usenull
for default.- Returns:
- the new or reused Display instance
-
createDisplay
public static Display createDisplay(String name, boolean reuse)
Create a Display entity.Native creation is lazily done at usage, ie.
Display.addReference()
.An already existing display connection of the same
name
will be reused ifreuse
istrue
, otherwise a new instance is being created.- Parameters:
name
- the display connection name which is a technical platform specific detail, seeAbstractGraphicsDevice.getConnection()
. Usenull
for default.reuse
- attempt to reuse an existing Display with samename
if set true, otherwise create a new instance.- Returns:
- the new or reused Display instance
-
createDisplay
public static Display createDisplay(String type, String name)
Create a Display entity.Native creation is lazily done at usage, ie.
Display.addReference()
.An already existing display connection of the same
name
will be reused.- Parameters:
type
- explicit NativeWindow type eg.NativeWindowFactory.TYPE_AWT
name
- the display connection name which is a technical platform specific detail, seeAbstractGraphicsDevice.getConnection()
. Usenull
for default.- Returns:
- the new or reused Display instance
-
createDisplay
public static Display createDisplay(String type, String name, boolean reuse)
Create a Display entity.Native creation is lazily done at usage, ie.
Display.addReference()
.An already existing display connection of the same
name
will be reused ifreuse
istrue
, otherwise a new instance is being created.- Parameters:
type
- explicit NativeWindow type eg.NativeWindowFactory.TYPE_AWT
name
- the display connection name which is a technical platform specific detail, seeAbstractGraphicsDevice.getConnection()
. Usenull
for default.reuse
- attempt to reuse an existing Display with samename
if set true, otherwise create a new instance.- Returns:
- the new or reused Display instance
-
createScreen
public static Screen createScreen(Display display, int index)
Create a Screen entity.Native creation is lazily done at usage, ie.
Screen.addReference()
.The lifecycle of this Screen's Display is handled via
Display.addReference()
andDisplay.removeReference()
.
-
createWindow
public static Window createWindow(CapabilitiesImmutable caps)
Create a top level Window entity on the default Display and default Screen.Native creation is lazily done at usage, ie.
Window.setVisible(boolean)
.An already existing default Display will be reused.
The lifecycle of this Window's Screen and Display is handled via
Screen.addReference()
andScreen.removeReference()
.
-
createWindow
public static Window createWindow(Screen screen, CapabilitiesImmutable caps)
Create a top level Window entity.Native creation is lazily done at usage, ie.
Window.setVisible(boolean)
.The lifecycle of this Window's Screen and Display is handled via
Screen.addReference()
andScreen.removeReference()
.
-
createWindow
public static Window createWindow(NativeWindow parentWindow, CapabilitiesImmutable caps)
Create a child Window entity attached to the given parent.
The Screen and Display information is regenerated utilizing the parents information, while reusing an existing Display.
In case
parentWindowObject
is aWindow
instance,
the new window is added to it's list of children.
This assures proper handling of visibility, creation and destruction.
WindowEvent.EVENT_WINDOW_RESIZED
is not propagated to the child window for layout
, you have to add an appropriateWindowListener
for this use case.
The parents visibility is passed to the new WindowIn case
parentWindowObject
is a differentNativeWindow
implementation,
you have to handle all events appropriate.The lifecycle of this Window's Screen and Display is handled via
Screen.addReference()
andScreen.removeReference()
.- Parameters:
parentWindowObject
- either a NativeWindow instance
-
createWindow
public static Window createWindow(String displayConnection, int screenIdx, long parentWindowHandle, CapabilitiesImmutable caps)
Create a child Window entity attached to the given parent, incl native creation- Parameters:
displayConnection
- the parent window's display connectionscreenIdx
- the desired screen indexparentWindowHandle
- the native parent window handlecaps
- the desired capabilities- Returns:
-
createWindow
public static Window createWindow(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps)
Ability to try a Window type with a constructor argument, if supported ..Currently only valid is
AWTWindow(Frame frame)
, to support an external created AWT Frame, ie the browsers embedded frame.- Parameters:
undecorated
- only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always
-
createDisplay
public static Display createDisplay(String type, long handle, boolean reuse)
Instantiate a Display entity using the native handle.
-
isScreenCompatible
public static boolean isScreenCompatible(NativeWindow parent, Screen childScreen)
-
createCompatibleScreen
public static Screen createCompatibleScreen(NativeWindow parent)
-
createCompatibleScreen
public static Screen createCompatibleScreen(NativeWindow parent, Screen childScreen)
-
-