How to add an Icon to a Java application
This are the instructions to add an icon the a Java Swing application. Icon is loaded from an image. In order to load this image we make use of File and Buffered Image classes. Icon can be shown in different…
This are the instructions to add an icon the a Java Swing application. Icon is loaded from an image. In order to load this image we make use of File and Buffered Image classes. Icon can be shown in different…
A developer may need to shut down a computer from a Java application. This post explains how it can be done. Ways to identify operating system In all solutions proposed here we are calling the OS directly to shutdown…
Images can be displayed in Java Swing using object JLabel. This is the partial code: JLabel label = new JLabel(); try { BufferedImage img = ImageIO.read(new File(IMG_FILES_PATH + IMG_FILENAME)); ImageIcon icon = new ImageIcon(img); label.setIcon(icon); } catch (IOException ex) {…
I programmed my own function, based on other examples: /** * Method that scale an image (BufferedImage) into the specified dimensions * @param sbi Source image * @param imageType Image type among BufferedImage.TYPE_… constants (example: TYPE_INT_ARGB) * @param dWidth Image…