Package snap.swing
Class AWTEnv
java.lang.Object
snap.gfx.GFXEnv
snap.swing.AWTEnv
A GFXEnv implementation using AWT.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Implementation of snap ColorSpace using java.awt.color.ColorSpace.static class
Implementation of snap ColorSpace using java.awt.color.ColorSpace. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beep()
Plays a beep.createSiteForURL
(WebURL aSiteURL) Creates a site for a URL.Creates a sound for given source.void
exit
(int aValue) This is really just here to help with TeaVM.static AWTEnv
get()
Returns a shared instance.Returns the root URL classes in Snap Jar as string.String[]
Returns a list of all system family names.getFontFile
(String aName) Returns a font file for given name.String[]
Returns a list of all system fontnames (excludes any that don't start with capital A-Z).String[]
getFontNames
(String aFamilyName) Returns a list of all font names for a given family name.This is really just here to help with TeaVM.getImageForSizeAndScale
(double aWidth, double aHeight, boolean hasAlpha, double aScale) Creates image for width, height and alpha and dpi scale (0 = screen dpi, 1 = 72 dpi, 2 = 144 dpi).getImageForSource
(Object aSource) Creates image from source.This is really just here to help with TeaVM.Override to return AWTPrefs for name.getResource
(Class<?> aClass, String aPath) Returns resource for class and path.double
Returns the screen resolution.double
Returns the screen scale.Returns a sound for given source.void
Tries to open the given file source with the platform reader.void
openTextFile
(Object aSource) Tries to open the given file source with the platform text file reader.void
Tries to open the given URL with the platform reader.static void
set()
Sets AWTEnv to be the default env.
-
Constructor Details
-
AWTEnv
public AWTEnv()Creates a new AWTEnv.
-
-
Method Details
-
getResource
Returns resource for class and path.- Specified by:
getResource
in classGFXEnv
-
getClassRoot
Returns the root URL classes in Snap Jar as string.- Specified by:
getClassRoot
in classGFXEnv
-
getFontNames
Returns a list of all system fontnames (excludes any that don't start with capital A-Z).- Specified by:
getFontNames
in classGFXEnv
-
getFamilyNames
Returns a list of all system family names.- Specified by:
getFamilyNames
in classGFXEnv
-
getFontNames
Returns a list of all font names for a given family name.- Specified by:
getFontNames
in classGFXEnv
-
getFontFile
Returns a font file for given name.- Specified by:
getFontFile
in classGFXEnv
-
getImageForSource
Creates image from source.- Specified by:
getImageForSource
in classGFXEnv
-
getImageForSizeAndScale
public Image getImageForSizeAndScale(double aWidth, double aHeight, boolean hasAlpha, double aScale) Creates image for width, height and alpha and dpi scale (0 = screen dpi, 1 = 72 dpi, 2 = 144 dpi).- Specified by:
getImageForSizeAndScale
in classGFXEnv
-
getSound
Returns a sound for given source. -
createSound
Creates a sound for given source.- Specified by:
createSound
in classGFXEnv
-
openFile
Tries to open the given file source with the platform reader. -
openURL
Tries to open the given URL with the platform reader. -
openTextFile
Tries to open the given file source with the platform text file reader.- Overrides:
openTextFile
in classGFXEnv
-
getScreenResolution
public double getScreenResolution()Returns the screen resolution.- Specified by:
getScreenResolution
in classGFXEnv
-
getScreenScale
public double getScreenScale()Returns the screen scale. Usually 1, but could be 2 for HiDPI/Retina displays.- Specified by:
getScreenScale
in classGFXEnv
-
beep
public void beep()Plays a beep. -
getPrefs
Override to return AWTPrefs for name. -
getMethod
public Method getMethod(Class<?> aClass, String aName, Class<?>... theClasses) throws NoSuchMethodException This is really just here to help with TeaVM.- Specified by:
getMethod
in classGFXEnv
- Throws:
NoSuchMethodException
-
createSiteForURL
Creates a site for a URL.- Overrides:
createSiteForURL
in classGFXEnv
-
exit
public void exit(int aValue) This is really just here to help with TeaVM. -
getHostname
This is really just here to help with TeaVM.- Overrides:
getHostname
in classGFXEnv
-
get
Returns a shared instance. -
set
public static void set()Sets AWTEnv to be the default env.
-