Package jmri.jmrit.etcs
Class ResourceUtil
- java.lang.Object
-
- jmri.jmrit.etcs.ResourceUtil
-
@API(status=EXPERIMENTAL) public class ResourceUtil extends java.lang.Object
Class to locate ERTMS Graphical and Audio resources.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.image.BufferedImage
convertColorToTransparent(java.awt.image.BufferedImage image)
Convert an image containing the DMI Background Colour to a transparent background.static java.io.File
getImageFile(java.lang.String fileName)
Get the File for an Image.static javax.swing.ImageIcon
getImageIcon(java.lang.String fileName)
Get the Image Icon for a given FileName.static java.awt.image.BufferedImage
getTransparentImage(java.lang.String str)
static void
playDmiSound(int sound)
Play one of the DMI UI Sounds. 1 - S1_toofast.wav - 2 secs 2 - S2_warning.wav - 3 secs 3 - S_info.wav - 1 sec 4 - click.wav - 1 secstatic java.awt.image.BufferedImage
readFile(java.io.File f)
static void
stopDmiSound(int sound)
Stop a DMI Sound from playing.
-
-
-
Method Detail
-
getImageFile
@Nonnull public static java.io.File getImageFile(java.lang.String fileName)
Get the File for an Image. Note this File may not actually exist.- Parameters:
fileName
- the Filename to search for.- Returns:
- File with appropriate Directory.
-
getImageIcon
@CheckForNull public static javax.swing.ImageIcon getImageIcon(java.lang.String fileName)
Get the Image Icon for a given FileName.- Parameters:
fileName
- the FileName to search for.- Returns:
- ImageIcon, or null if image not located.
-
getTransparentImage
@CheckForNull public static java.awt.image.BufferedImage getTransparentImage(@Nonnull java.lang.String str)
-
readFile
@CheckForNull public static java.awt.image.BufferedImage readFile(java.io.File f)
-
convertColorToTransparent
@CheckForNull public static java.awt.image.BufferedImage convertColorToTransparent(@CheckForNull java.awt.image.BufferedImage image)
Convert an image containing the DMI Background Colour to a transparent background.- Parameters:
image
- the Image to convert.- Returns:
- converted image, or null.
-
playDmiSound
public static void playDmiSound(int sound) throws java.lang.IllegalArgumentException
Play one of the DMI UI Sounds. 1 - S1_toofast.wav - 2 secs 2 - S2_warning.wav - 3 secs 3 - S_info.wav - 1 sec 4 - click.wav - 1 sec- Parameters:
sound
- which Sound, plays once.- Throws:
java.lang.IllegalArgumentException
-
stopDmiSound
public static void stopDmiSound(int sound)
Stop a DMI Sound from playing.- Parameters:
sound
- normally 2, the only sound which plays in a loop.
-
-