Try using this:-
this.icon = ImageIO.read(new FileInputStream("res/test.txt"));
where res
folder is present at the same level as your src
folder. Also, if you notice, the slash /
before the res
folder name was removed.
More Related Contents:
- Java – get pixel array from image
- Convert each animated GIF frame to a separate BufferedImage
- JComponents not showing up with picture background?
- How to scale a BufferedImage
- How to get image height and width using java?
- Unable to read JPEG image using ImageIO.read(File file)
- How to setSize of image using RescaleOp
- Java converting Image to BufferedImage
- BufferedImage not being cleared before each rendering
- Rotating BufferedImage instances
- Including Images with an executable jar
- Rotate BufferedImage Inside JPanel
- Convert RGB values to Integer
- How to check a uploaded file whether it is an image or other file?
- Creating animated GIF with ImageIO?
- Rotate an image in java
- Re-sizing an image without losing quality
- Converting `BufferedImage` to `Mat` in OpenCV
- Java – resize image without losing quality
- How to save a BufferedImage as a File
- ImageIO not able to write a JPEG file
- Java: Filling a BufferedImage with transparent pixels
- Exporting a JPanel to an image
- Load a sprites image in java
- Java BufferedImage getting red, green and blue individually
- Drawing a Component to BufferedImage causes display corruption
- Rotate a buffered image in Java
- How to return a PNG image from Jersey REST service method to the browser
- Convert a Graphics2D to an Image or BufferedImage
- How can I import java.awt.image.BufferedImage in Android Studio